Dockerfile 700 B

123456789101112131415161718192021222324
  1. FROM node:16 as builder
  2. WORKDIR /portal
  3. COPY . .
  4. ARG proxy=""
  5. RUN if [ "$proxy" != "" ]; \
  6. then npm config set proxy "$proxy" && npm config set https-proxy "$proxy"; \
  7. else echo Do not set proxy; \
  8. fi
  9. RUN npm install && chmod +x node_modules/.bin/tsc \
  10. && chmod +x node_modules/.bin/vite \
  11. && npm run build
  12. FROM nginx:alpine
  13. WORKDIR /portal
  14. COPY --from=builder /portal/dist/ /usr/share/nginx/html/
  15. RUN rm /etc/nginx/conf.d/default.conf
  16. COPY nginx.conf /etc/nginx/nginx.conf
  17. COPY default.conf.template /etc/nginx/conf.d
  18. # hadolint ignore=DL3025
  19. CMD /bin/sh -c "envsubst '80' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;'