- Add an API container entrypoint that waits for PostgreSQL, runs Prisma migrations, seeds demo data, and then starts NestJS. - Keep Prisma CLI and seed dependencies available in the API runtime image and copy seed source dependencies into the container. - Add Docker Compose healthchecks and health-based startup ordering for PostgreSQL, API, and Nginx web services. - Add Docker initialization environment switches for migrations, seed, and startup retries. - Add a dedicated Docker deployment guide covering services, ports, initialization, HTTPS, production variables, backup, restore, and troubleshooting. - Update README, AGENTS, installation, deployment, progress, and environment example docs for the Dockerized workflow.
25 lines
724 B
Docker
25 lines
724 B
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN npm run prisma:generate
|
|
RUN npm run server:build
|
|
|
|
# Production stage
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
COPY --from=builder /app/server/dist ./server/dist
|
|
COPY --from=builder /app/server/src ./server/src
|
|
COPY --from=builder /app/server/prisma ./server/prisma
|
|
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
|
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
|
COPY scripts/docker-api-entrypoint.sh ./scripts/docker-api-entrypoint.sh
|
|
RUN chmod +x ./scripts/docker-api-entrypoint.sh
|
|
EXPOSE 3100
|
|
CMD ["./scripts/docker-api-entrypoint.sh"]
|