Dockerfile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_PRIMARY_COLOR="#03a9f4"
  11. ARG MUSARE_DEBUG_VERSION=true
  12. ARG MUSARE_DEBUG_GIT_REMOTE=false
  13. ARG MUSARE_DEBUG_GIT_REMOTE_URL=false
  14. ARG MUSARE_DEBUG_GIT_BRANCH=true
  15. ARG MUSARE_DEBUG_GIT_LATEST_COMMIT=true
  16. ARG MUSARE_DEBUG_GIT_LATEST_COMMIT_SHORT=true
  17. ENV FRONTEND_MODE=${FRONTEND_MODE} \
  18. FRONTEND_PROD_DEVTOOLS=${FRONTEND_PROD_DEVTOOLS} \
  19. MUSARE_SITENAME=${MUSARE_SITENAME} \
  20. MUSARE_PRIMARY_COLOR=${MUSARE_PRIMARY_COLOR} \
  21. MUSARE_DEBUG_VERSION=${MUSARE_DEBUG_VERSION} \
  22. MUSARE_DEBUG_GIT_REMOTE=${MUSARE_DEBUG_GIT_REMOTE} \
  23. MUSARE_DEBUG_GIT_REMOTE_URL=${MUSARE_DEBUG_GIT_REMOTE_URL} \
  24. MUSARE_DEBUG_GIT_BRANCH=${MUSARE_DEBUG_GIT_BRANCH} \
  25. MUSARE_DEBUG_GIT_LATEST_COMMIT=${MUSARE_DEBUG_GIT_LATEST_COMMIT} \
  26. MUSARE_DEBUG_GIT_LATEST_COMMIT_SHORT=${MUSARE_DEBUG_GIT_LATEST_COMMIT_SHORT}
  27. RUN apt-get update && apt-get install nginx -y
  28. RUN mkdir -p /opt/.git /opt/types /opt/app /run/nginx
  29. WORKDIR /opt/app
  30. COPY .git /opt/.git
  31. COPY types /opt/types
  32. COPY frontend /opt/app
  33. COPY --from=frontend_node_modules /opt/app/node_modules node_modules
  34. RUN bash -c '([[ "${FRONTEND_MODE}" == "development" ]] && exit 0) || npm run prod'
  35. RUN chmod u+x entrypoint.sh
  36. ENTRYPOINT bash /opt/app/entrypoint.sh
  37. EXPOSE 80/tcp