Dockerfile 831 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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/.next/standalone ./
  26. COPY --from=builder /app/web/.next/static ./.next/static
  27. COPY docker/entrypoint.sh ./entrypoint.sh
  28. RUN chmod +x ./entrypoint.sh
  29. ARG COMMIT_SHA
  30. ENV COMMIT_SHA ${COMMIT_SHA}
  31. EXPOSE 3000
  32. ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]