mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-02-01 18:20:17 +01:00
添加各个节点的镜像制作
This commit is contained in:
20
examples/frontend/Dockerfile
Normal file
20
examples/frontend/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# 安装nginx
|
||||
RUN mkdir /run/nginx && apk add nginx
|
||||
|
||||
# 拷贝编译文件
|
||||
COPY dist /app/dist
|
||||
|
||||
# 拷贝nginx代理文件
|
||||
COPY crawlab.conf /etc/nginx/conf.d
|
||||
|
||||
# 拷贝执行脚本
|
||||
COPY docker_init.sh /app/docker_init.sh
|
||||
|
||||
# 定义后端API脚本
|
||||
ENV CRAWLAB_API_ADDRESS http://localhost:8000
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["/bin/sh", "/app/docker_init.sh"]
|
||||
3
examples/frontend/README.md
Normal file
3
examples/frontend/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# 前端镜像制作
|
||||
|
||||
前端需要手动build拿到编译后的文件,然后放入此目录进行镜像构建
|
||||
13
examples/frontend/crawlab.conf
Normal file
13
examples/frontend/crawlab.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
server {
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
#gzip_http_version 1.0;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
gzip_vary off;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
listen 8080;
|
||||
root /app/dist;
|
||||
index index.html;
|
||||
}
|
||||
23
examples/frontend/docker_init.sh
Executable file
23
examples/frontend/docker_init.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# replace default api path to new one
|
||||
if [ "${CRAWLAB_API_ADDRESS}" = "" ];
|
||||
then
|
||||
:
|
||||
else
|
||||
jspath=`ls /app/dist/js/app.*.js`
|
||||
sed -i "s?localhost:8000?${CRAWLAB_API_ADDRESS}?g" ${jspath}
|
||||
fi
|
||||
|
||||
# replace base url
|
||||
if [ "${CRAWLAB_BASE_URL}" = "" ];
|
||||
then
|
||||
:
|
||||
else
|
||||
indexpath=/app/dist/index.html
|
||||
sed -i "s?/js/?${CRAWLAB_BASE_URL}/js/?g" ${indexpath}
|
||||
sed -i "s?/css/?${CRAWLAB_BASE_URL}/css/?g" ${indexpath}
|
||||
fi
|
||||
|
||||
# start nginx
|
||||
nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user