Dockerfile 791 B

1234567891011121314151617181920212223242526272829303132
  1. #FROM node:18.16.0-alpine3.16 AS build
  2. FROM node:lts-alpine AS build
  3. WORKDIR /opt/www
  4. COPY . /opt/www/
  5. ARG NODE_ENV=production
  6. ENV NODE_ENV $NODE_ENV
  7. #RUN yarn config set registry https://mirrors.tencent.com/npm
  8. RUN echo "NODE_ENV=$NODE_ENV"
  9. #RUN yarn install --network-timeout 100000
  10. RUN yarn config set registry http://mirrors.cloud.tencent.com/npm/
  11. RUN npm config set registry http://mirrors.cloud.tencent.com/npm/
  12. RUN yarn config list
  13. RUN yarn install && \
  14. if [ "$NODE_ENV" = "development" ]; then yarn build --mode development; fi && \
  15. if [ "$NODE_ENV" = "production" ]; then yarn build --mode production; fi && \
  16. yarn cache clean
  17. RUN yarn generate:version
  18. FROM nginx:alpine
  19. COPY --from=build /opt/www/dist /usr/share/nginx/html