Dockerfile 665 B

123456789101112131415161718192021222324252627282930313233
  1. FROM node:18 AS frontend_node_modules
  2. RUN mkdir -p /opt/app
  3. WORKDIR /opt/app
  4. COPY package.json /opt/app/package.json
  5. COPY package-lock.json /opt/app/package-lock.json
  6. RUN npm install --silent
  7. FROM node:18 AS musare_frontend
  8. ARG FRONTEND_MODE=production
  9. ENV FRONTEND_MODE=${FRONTEND_MODE}
  10. RUN apt update
  11. RUN apt install nginx -y
  12. RUN mkdir -p /opt/app /opt/types
  13. WORKDIR /opt/app
  14. COPY . /opt/app
  15. COPY --from=frontend_node_modules /opt/app/node_modules node_modules
  16. RUN mkdir -p /run/nginx
  17. RUN bash -c '([[ "${FRONTEND_MODE}" == "development" ]] && exit 0) || npm run prod'
  18. RUN chmod u+x entrypoint.sh
  19. ENTRYPOINT bash /opt/app/entrypoint.sh
  20. EXPOSE 80/tcp