Signed-off-by: Logaxn <logaxn@foxmail.com>

This commit is contained in:
Logaxn 2019-03-16 16:19:29 +08:00
parent 22b28e1755
commit ddd18d6a00
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
FROM node:11.10.0-alpine FROM node:11.10.0-alpine as Builder
# 由于国内网络问题yarn run build:prod 失败 # 由于国内网络问题yarn run build:prod 失败
# 暂时通过阿里云容器镜像服务的海外机器构建功能解决 # 暂时通过阿里云容器镜像服务的海外机器构建功能解决
@ -14,12 +14,16 @@ RUN yarn install
RUN yarn run build:prod RUN yarn run build:prod
WORKDIR dist
RUN GZIP=-9 tar -pzcf ../dist.tgz *
# https://docs.docker.com/develop/develop-images/multistage-build/ # https://docs.docker.com/develop/develop-images/multistage-build/
FROM busybox FROM busybox
COPY --from=0 /app/dist /app_dist # COPY --from=0 /app/dist /app_dist
COPY --from=Builder /app/dist.tgz /dist.tgz
# git push aliyun master:master # git push aliyun master:master
@ -29,3 +33,4 @@ COPY --from=0 /app/dist /app_dist
# 将镜像里的 /app_dist 目录拷出来 # 将镜像里的 /app_dist 目录拷出来
# docker run --rm -v $HOME/dist:/dist registry.cn-shenzhen.aliyuncs.com/logaxn/zealouscrm-vue cp -r -T /app_dist /dist # docker run --rm -v $HOME/dist:/dist registry.cn-shenzhen.aliyuncs.com/logaxn/zealouscrm-vue cp -r -T /app_dist /dist
# docker run --rm -v $HOME/dist:/dist registry.cn-shenzhen.aliyuncs.com/logaxn/zealouscrm-vue tar -pzxf /dist.tgz -C /dist