-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (37 loc) · 1.37 KB
/
Copy pathDockerfile
File metadata and controls
42 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM node:22-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --ignore-scripts
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Dummy build-time env vars so module initialization doesn't throw.
# These are never used at runtime — real values come from docker-compose / .env.
ARG DATABASE_URL=postgresql://dummy:dummy@dummy:5432/dummy
ARG REDIS_URL=redis://dummy:6379
# Empty NEXT_PUBLIC_LANDING_PAGE_URL at build time so client code falls back to /signin
ARG NEXT_PUBLIC_LANDING_PAGE_URL=""
RUN npx prisma generate
RUN --mount=type=cache,target=/app/.next/cache \
DATABASE_URL="${DATABASE_URL}" \
REDIS_URL="${REDIS_URL}" \
NEXT_PUBLIC_LANDING_PAGE_URL="${NEXT_PUBLIC_LANDING_PAGE_URL}" \
NODE_OPTIONS="--max-old-space-size=4096" \
npm run build
RUN npm prune --omit=dev
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/src ./src
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/server.js ./server.js
COPY --from=builder /app/next.config.ts ./next.config.ts
EXPOSE 3000
CMD ["npm", "run", "start"]