Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. FROM node:18 AS frontend_node_modules
  2. RUN mkdir -p /opt/app
  3. WORKDIR /opt/app
  4. COPY frontend/package.json frontend/package-lock.json /opt/app/
  5. RUN npm install --silent
  6. FROM node:18 AS musare_frontend
  7. ARG FRONTEND_MODE=production
  8. ARG FRONTEND_PROD_DEVTOOLS=false
  9. ARG MUSARE_SITENAME=Musare
  10. ARG MUSARE_DEBUG_VERSION=true
  11. ARG MUSARE_DEBUG_GIT_REMOTE=false
  12. ARG MUSARE_DEBUG_GIT_REMOTE_URL=false
  13. ARG MUSARE_DEBUG_GIT_BRANCH=true
  14. ARG MUSARE_DEBUG_GIT_LATEST_COMMIT=true
  15. ARG MUSARE_DEBUG_GIT_LATEST_COMMIT_SHORT=true
  16. ENV FRONTEND_MODE=${FRONTEND_MODE} \
  17. FRONTEND_PROD_DEVTOOLS=${FRONTEND_PROD_DEVTOOLS} \
  18. MUSARE_SITENAME=${MUSARE_SITENAME} \
  19. MUSARE_DEBUG_VERSION=${MUSARE_DEBUG_VERSION} \
  20. MUSARE_DEBUG_GIT_REMOTE=${MUSARE_DEBUG_GIT_REMOTE} \
  21. MUSARE_DEBUG_GIT_REMOTE_URL=${MUSARE_DEBUG_GIT_REMOTE_URL} \
  22. MUSARE_DEBUG_GIT_BRANCH=${MUSARE_DEBUG_GIT_BRANCH} \
  23. MUSARE_DEBUG_GIT_LATEST_COMMIT=${MUSARE_DEBUG_GIT_LATEST_COMMIT} \
  24. MUSARE_DEBUG_GIT_LATEST_COMMIT_SHORT=${MUSARE_DEBUG_GIT_LATEST_COMMIT_SHORT}
  25. RUN apt-get update && apt-get install nginx -y
  26. RUN mkdir -p /opt/.git /opt/types /opt/app /run/nginx
  27. WORKDIR /opt/app
  28. COPY .git /opt/.git
  29. COPY types /opt/types
  30. COPY frontend /opt/app
  31. COPY --from=frontend_node_modules /opt/app/node_modules node_modules
  32. RUN bash -c '([[ "${FRONTEND_MODE}" == "development" ]] && exit 0) || npm run prod'
  33. RUN chmod u+x entrypoint.sh
  34. ENTRYPOINT bash /opt/app/entrypoint.sh
  35. EXPOSE 80/tcp