-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.02 KB
/
Dockerfile
File metadata and controls
48 lines (35 loc) · 1.02 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
# Stage 1: Build
FROM node:24-alpine AS builder
RUN apk add --no-cache tzdata bash
WORKDIR /app
# Enable corepack for yarn
RUN corepack enable
# Copy package files
COPY package.json yarn.lock .yarnrc.yml prisma.config.ts ./
COPY .yarn ./.yarn
COPY .env.example ./.env
# Install dependencies
RUN yarn install --immutable
# Copy source code and configuration
COPY tsconfig.json ./
COPY prisma ./prisma
COPY src ./src
# Build application (generates Prisma Client and compiles TypeScript)
RUN yarn build
# Stage 3: Production
FROM node:24-alpine AS runner
RUN apk add --no-cache tzdata
WORKDIR /app
# Enable corepack for yarn
RUN corepack enable
# Copy package files for production dependencies
COPY package.json yarn.lock .yarnrc.yml prisma.config.ts ./
COPY .yarn ./.yarn
# Install production dependencies only
RUN yarn workspaces focus --production
# Copy built application from builder
COPY --from=builder /app/dist ./dist
# Copy prisma schema for runtime
COPY prisma ./prisma
ENV NODE_ENV=production
CMD ["node", "./dist/main.js"]