FROM alpine AS builder
WORKDIR /home/app
RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com

FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2-zabbix
ADD ./ /var/www/web_live
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_live
COPY --from=builder /home/app/package.json ./package.json
COPY --from=builder /home/app/node_modules ./node_modules
RUN yarn cross-env run_server=production nuxt build
RUN yarn cross-env run_server=production node upload.js
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml pDockerfile README.md pStart.sh
EXPOSE 3000
RUN chmod +x start.sh
ENTRYPOINT ["./start.sh"]
