fd33d5c987
Prisma 7 reads datasource.url from prisma.config.ts, not schema.prisma. The final Docker stage copied prisma/ but not the root config file, so `prisma migrate deploy` always failed with "datasource.url property is required" regardless of DATABASE_URL being set correctly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
29 lines
1.3 KiB
Docker
29 lines
1.3 KiB
Docker
FROM node:22-bookworm-slim AS build
|
|
WORKDIR /app
|
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
COPY package.json package-lock.json ./
|
|
COPY prisma ./prisma
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
FROM node:22-bookworm-slim
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production HOSTNAME=0.0.0.0 PORT=3000 NEXT_TELEMETRY_DISABLED=1
|
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates curl && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=build /app/.next/standalone ./
|
|
# Standalone only traces what server.js imports — overlay the full node_modules
|
|
# so the `prisma` CLI (invoked by name below, not imported) is present too.
|
|
COPY --from=build /app/node_modules ./node_modules
|
|
COPY --from=build /app/.next/static ./.next/static
|
|
COPY --from=build /app/public ./public
|
|
COPY --from=build /app/prisma ./prisma
|
|
# Prisma 7 reads datasource.url from this file, not schema.prisma — required
|
|
# for `prisma migrate deploy` at container start.
|
|
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
|
|
COPY scripts/cron-runner.mjs ./scripts/cron-runner.mjs
|
|
RUN mkdir -p /app/.data/uploads && chown -R node:node /app
|
|
USER node
|
|
EXPOSE 3000
|
|
CMD ["sh", "-c", "npx prisma migrate deploy && (node scripts/cron-runner.mjs &) && exec node server.js"]
|