Dockerfile 956 B

1234567891011121314151617181920212223242526272829
  1. # Single image for both modes. The repository itself is bind-mounted at runtime
  2. # (see docker-compose.yml), so day-to-day code changes never require a rebuild —
  3. # the entrypoint installs/builds on start and `dev` mode additionally watches.
  4. FROM node:22-bookworm-slim
  5. # openssl is required by Prisma's query engine; ca-certificates for outbound TLS.
  6. RUN apt-get update \
  7. && apt-get install -y --no-install-recommends openssl ca-certificates curl \
  8. && rm -rf /var/lib/apt/lists/*
  9. WORKDIR /app
  10. # Warm the layer cache with the dependency manifests only.
  11. COPY package.json package-lock.json ./
  12. RUN npm ci
  13. COPY . .
  14. RUN npx prisma generate
  15. COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
  16. RUN chmod +x /usr/local/bin/entrypoint.sh
  17. ENV NODE_ENV=production
  18. EXPOSE 3000
  19. HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
  20. CMD curl -fsS http://127.0.0.1:3000/health || exit 1
  21. ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]