Adjust CI pipeline.

This commit is contained in:
2025-03-12 08:26:49 -05:00
parent cc2679a9b2
commit 4a69d64f28
3 changed files with 19 additions and 12 deletions

View File

@@ -1,23 +1,25 @@
FROM node:18-alpine AS builder
# Set working directory
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
# Copy package.json and install dependencies
COPY package.json pnpm-lock.yaml ./
RUN npm ci
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
# Copy the rest of the app and build
COPY . .
RUN npm run build
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
# Stage 2: Minimal image for exporting build artifacts
FROM alpine:latest
# Set working directory for output
WORKDIR /output
WORKDIR /app
# Copy the built files from the builder stage
COPY --from=builder /app/build .
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/build .
# No CMD because this image is just used to extract build files