Dockerfile 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # base image
  2. FROM node:20.11-alpine3.19 AS base
  3. LABEL maintainer="takatost@gmail.com"
  4. RUN apk add --no-cache tzdata
  5. # install packages
  6. FROM base as packages
  7. WORKDIR /app/web
  8. COPY package.json .
  9. COPY yarn.lock .
  10. RUN yarn install --frozen-lockfile
  11. # build resources
  12. FROM base as builder
  13. WORKDIR /app/web
  14. COPY --from=packages /app/web/ .
  15. COPY . .
  16. RUN yarn build
  17. # production stage
  18. FROM base as production
  19. ENV NODE_ENV production
  20. ENV EDITION SELF_HOSTED
  21. ENV DEPLOY_ENV PRODUCTION
  22. ENV CONSOLE_API_URL http://127.0.0.1:5001
  23. ENV APP_API_URL http://127.0.0.1:5001
  24. ENV PORT 3000
  25. # set timezone
  26. ENV TZ UTC
  27. RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
  28. && echo ${TZ} > /etc/timezone
  29. WORKDIR /app/web
  30. COPY --from=builder /app/web/public ./public
  31. COPY --from=builder /app/web/.next/standalone ./
  32. COPY --from=builder /app/web/.next/static ./.next/static
  33. COPY docker/entrypoint.sh ./entrypoint.sh
  34. ARG COMMIT_SHA
  35. ENV COMMIT_SHA ${COMMIT_SHA}
  36. EXPOSE 3000
  37. ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]