-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
49 lines (34 loc) · 1.18 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
49
# Stage 1: Build the application
FROM node:22-slim AS builder
# Build argument for git commit SHA
ARG GIT_COMMIT=unknown
ENV GIT_COMMIT=${GIT_COMMIT}
# Install pnpm
RUN npm install -g pnpm
# Install build tools
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manager files, shared config, and workspace package.json files first
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY apps/api/package.json ./apps/api/
COPY packages/types/package.json ./packages/types/
COPY packages/swapper/package.json ./packages/swapper/
RUN pnpm install
# Copy the rest of the source code
COPY . .
# Build the application
RUN pnpm run build
# Deploy the target app ('api') to /prod_build
RUN pnpm --filter ./apps/api deploy --legacy --prod /prod_build
# Stage 2: Production environment
FROM node:22-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE ${PORT}
# Install pnpm
RUN npm install -g pnpm
# Copy the deployed application from the builder stage
COPY --from=builder /prod_build .
# Command to run the application (path relative to WORKDIR)
CMD ["node", "dist/index.js"]