12345678910111213141516171819202122232425 |
- FROM node:lts-alpine as builder
- WORKDIR /code
- ADD package.json /code
- RUN npm install
- ADD . /code
- RUN npm run build
- #环境变量写在build后面否则找不到指令
- ENV PROJECT_ENV production
- ENV NODE_ENV production
- FROM nginx:alpine
- # 设置时区
- #RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- #RUN echo 'Asia/Shanghai' >/etc/timezone
- COPY --from=builder code/dist/ /usr/share/nginx/html/
- COPY ./mainindex.html /usr/share/nginx/html/index.html
- COPY ./docker/prod/nginx.conf /etc/nginx/nginx.conf
- EXPOSE 80
|