|
2 | 2 | # Use a Node.js image as the base for building the application |
3 | 3 | FROM node:22-alpine AS builder |
4 | 4 |
|
| 5 | +# Enable pnpm via corepack |
| 6 | +RUN corepack enable && corepack prepare pnpm@latest --activate |
| 7 | + |
5 | 8 | # Set the working directory inside the container |
6 | 9 | WORKDIR /app |
7 | 10 |
|
8 | | -# Copy package.json and package-lock.json to install dependencies |
9 | | -COPY package.json package-lock.json ./ |
| 11 | +# Copy package.json and pnpm-lock.yaml to install dependencies |
| 12 | +COPY package.json pnpm-lock.yaml ./ |
10 | 13 |
|
11 | 14 | # Install dependencies (ignoring scripts to prevent running the prepare script) |
12 | | -RUN npm install --ignore-scripts |
| 15 | +RUN pnpm install --frozen-lockfile --ignore-scripts |
13 | 16 |
|
14 | 17 | # Copy the rest of the application source code |
15 | 18 | COPY . . |
16 | 19 |
|
17 | 20 | # Build the application using TypeScript |
18 | | -RUN npm run build |
| 21 | +RUN pnpm run build |
19 | 22 |
|
20 | 23 | # Use a smaller Node.js image for the final image |
21 | 24 | FROM node:22-slim AS release |
22 | 25 |
|
| 26 | +# Enable pnpm via corepack |
| 27 | +RUN corepack enable && corepack prepare pnpm@latest --activate |
| 28 | + |
23 | 29 | # Set the working directory inside the container |
24 | 30 | WORKDIR /app |
25 | 31 |
|
26 | 32 | # Copy the built application from the builder stage |
27 | 33 | COPY --from=builder /app/dist /app/dist |
28 | 34 | COPY --from=builder /app/package.json /app/package.json |
29 | | -COPY --from=builder /app/package-lock.json /app/package-lock.json |
| 35 | +COPY --from=builder /app/pnpm-lock.yaml /app/pnpm-lock.yaml |
30 | 36 |
|
31 | 37 | # Install only production dependencies |
32 | | -RUN npm ci --omit=dev --ignore-scripts |
| 38 | +RUN pnpm install --prod --frozen-lockfile --ignore-scripts |
33 | 39 |
|
34 | 40 | # Set environment variables for API key and custom API URL if needed |
35 | 41 |
|
|
0 commit comments