-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
42 lines (34 loc) · 1.15 KB
/
Dockerfile
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
# Base stage with Node.js and pnpm
FROM node:22-alpine AS base
RUN npm install -g [email protected]
WORKDIR /app
# Dependencies stage - install all dependencies
FROM base AS deps
COPY package.json pnpm-workspace.yaml ./
COPY api/package.json api/
COPY worker/package.json worker/
RUN pnpm install --frozen-lockfile
# Builder stage - build both services
FROM deps AS builder
COPY . .
RUN pnpm -r run build
# Production stage - create minimal image
FROM node:22-alpine AS runner
RUN npm install -g [email protected]
WORKDIR /app
# Copy production dependencies and built assets
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/api/node_modules ./api/node_modules
COPY --from=deps /app/worker/node_modules ./worker/node_modules
COPY --from=builder /app/api/dist ./api/dist
COPY --from=builder /app/worker/dist ./worker/dist
# Copy package files needed for production
COPY package.json pnpm-workspace.yaml ./
COPY api/package.json ./api/
COPY worker/package.json ./worker/
# Copy the entrypoint script
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
ENV NODE_ENV=production
# Use entrypoint script to determine which service to run
ENTRYPOINT ["./entrypoint.sh"]