-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (37 loc) Β· 1.11 KB
/
Dockerfile
File metadata and controls
48 lines (37 loc) Β· 1.11 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
43
44
45
46
47
48
FROM node:20-alpine AS base
WORKDIR /app
RUN npm install -g pnpm
# Install dependencies
FROM base AS deps
COPY package.json pnpm-lock.yaml ./
COPY prisma ./prisma
RUN pnpm install --frozen-lockfile
# Build the app
FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/prisma ./prisma
COPY . .
RUN pnpm run build
# Production image
FROM base AS runner
WORKDIR /app
# Copy built application
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/data ./data
# β
FIX: Copy the entire scripts directory needed by the setup script
COPY --from=builder /app/scripts ./scripts
# β
FIX: Copy node_modules instead of reinstalling
COPY --from=builder /app/node_modules ./node_modules
# Copy and setup script with proper permissions
COPY scripts/setup.sh /app/setup.sh
RUN chmod +x /app/setup.sh && \
sed -i 's/\r$//' /app/setup.sh
ENV PORT=3000
ENV NODE_ENV=production
ENV HOST=0.0.0.0
EXPOSE 3000
ENTRYPOINT ["/app/setup.sh"]
CMD ["pnpm", "start"]