Dockerfile 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # base image
  2. FROM node:18.17.0-alpine AS base
  3. # install packages
  4. FROM base as packages
  5. LABEL maintainer="takatost@gmail.com"
  6. WORKDIR /app/web
  7. COPY package.json .
  8. COPY yarn.lock .
  9. RUN yarn --only=prod
  10. # build resources
  11. FROM base as builder
  12. WORKDIR /app/web
  13. COPY --from=packages /app/web/ .
  14. COPY . .
  15. RUN yarn build
  16. # production stage
  17. FROM base as production
  18. ENV NODE_ENV production
  19. ENV EDITION SELF_HOSTED
  20. ENV DEPLOY_ENV PRODUCTION
  21. ENV CONSOLE_API_URL http://127.0.0.1:5001
  22. ENV APP_API_URL http://127.0.0.1:5001
  23. ENV PORT 3000
  24. WORKDIR /app/web
  25. COPY --from=builder /app/web/public ./public
  26. COPY --from=builder /app/web/.next/standalone ./
  27. COPY --from=builder /app/web/.next/static ./.next/static
  28. COPY docker/entrypoint.sh ./entrypoint.sh
  29. RUN chmod +x ./entrypoint.sh
  30. ARG COMMIT_SHA
  31. ENV COMMIT_SHA ${COMMIT_SHA}
  32. EXPOSE 3000
  33. ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]