From c86b6aebfe48b7dcb8ddf4085d0e007017309997 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Sat, 24 Aug 2019 22:01:23 +0800 Subject: [PATCH] updated Dockerfile.frontend.alpine --- docker/Dockerfile.frontend.alpine | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.frontend.alpine b/docker/Dockerfile.frontend.alpine index d313cdcb2..f809ee7ce 100644 --- a/docker/Dockerfile.frontend.alpine +++ b/docker/Dockerfile.frontend.alpine @@ -1,10 +1,20 @@ +FROM node:8.16.0 AS frontend-build + +ADD ./frontend /app +WORKDIR /app + +# install frontend +RUN npm install -g yarn && yarn install --registry=https://registry.npm.taobao.org + +RUN npm run build:prod + FROM alpine:latest # 安装nginx RUN mkdir /run/nginx && apk add nginx # 拷贝编译文件 -COPY dist /app/dist +COPY --from=frontend-build /app/dist /app/dist # 拷贝nginx代理文件 COPY crawlab.conf /etc/nginx/conf.d @@ -12,9 +22,6 @@ 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"] \ No newline at end of file