1234567891011121314151617181920212223242526272829 |
- FROM node:lts-alpine as builder
- WORKDIR /code
- ADD package.json /code
- ENV NODE_OPTIONS=--openssl-legacy-provider
- RUN export NODE_OPTIONS
- RUN npm install
- ADD . /code
- RUN npm run build:prod
- #环境变量写在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 simsun.ttc /usr/share/fonts/simsun.ttc
- COPY --from=builder code/dist/ /usr/share/nginx/html/
- COPY ./nginx.conf /etc/nginx/nginx.conf
- EXPOSE 80
|