Dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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/refs /opt/types /opt/app /run/nginx
  27. WORKDIR /opt/app
  28. COPY .git/config .git/HEAD /opt/.git/
  29. COPY .git/refs /opt/.git/refs
  30. COPY types /opt/types
  31. COPY frontend /opt/app
  32. COPY --from=frontend_node_modules /opt/app/node_modules node_modules
  33. RUN bash -c '([[ "${FRONTEND_MODE}" == "development" ]] && exit 0) || npm run prod'
  34. RUN chmod u+x entrypoint.sh
  35. ENTRYPOINT bash /opt/app/entrypoint.sh
  36. EXPOSE 80/tcp