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

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
node_modules
.git
.gitignore
*.md
dist

View File

@@ -37,7 +37,7 @@ steps:
- echo "$REGISTRY_PASSWORD" | docker login registry.binderlab.io --username "$REGISTRY_USERNAME" --password-stdin
- docker pull registry.binderlab.io/harbormaster-client:latest
- docker create --name temp-harbormaster-client registry.binderlab.io/harbormaster-client:latest
- docker cp temp-harbormaster-client:/build $DEPLOY_PATH
- docker cp temp-harbormaster-client:/app/build $DEPLOY_PATH
- docker rm temp-harbormaster-client
when:
event: manual

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