force recompilation of binaries

This commit is contained in:
2025-08-01 00:27:37 -04:00
parent cac5ebff3a
commit e3710f7152

View File

@@ -1,5 +1,7 @@
# === STAGE 1: Build & Dependencies === # === STAGE 1: Build & Dependencies ===
FROM arm64v8/node:22 AS builder FROM arm64v8/node:22 AS builder
ENV SHARP_IGNORE_GLOBAL_CLI_BINARIES=1
ENV VIPS_DISABLE_DEPS=1
WORKDIR /app WORKDIR /app
@@ -21,30 +23,28 @@ COPY . .
RUN --mount=type=cache,target=/app/.vinxi \ RUN --mount=type=cache,target=/app/.vinxi \
pnpm run build pnpm run build
# ^ produces .output (build artifact) and .vinxi (build cache)
# === STAGE 2: Generate Production-only Files === # === STAGE 2: Generate Production-only Files ===
FROM arm64v8/node:22 AS production_builder FROM arm64v8/node:22 AS production_builder
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install jq to process the package.json file.
# Note: jq is not in the base image, so we must install it.
RUN apt-get update && apt-get install -y jq
WORKDIR /app WORKDIR /app
# Enable corepack and install jq as a system-level dependency.
RUN corepack enable && corepack prepare pnpm@latest --activate && \
apt-get update && apt-get install -y jq
# Copy the original lockfile and package.json from the builder stage. # Copy the original lockfile and package.json from the builder stage.
COPY --from=builder /app/package.json ./ COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml ./ COPY --from=builder /app/pnpm-lock.yaml ./
# Create a new, production-only package.json file. # Create a new, production-only package.json file.
# We use 'jq' to remove the 'devDependencies' key from the original package.json.
RUN jq 'del(.devDependencies)' package.json > package.prod.json RUN jq 'del(.devDependencies)' package.json > package.prod.json
# Now, generate a production-only pnpm-lock.yaml # Now, generate a production-only pnpm-lock.yaml
# We run `pnpm install` again, but with `--prod`, and it will # We use a single, efficient command for this.
# generate a new lockfile based on the stripped-down dependencies. RUN --mount=type=cache,target=/root/.local/share/pnpm/store/v3 \
RUN --mount=type=cache,target=/root/.local/share/pnpm/store/v3 pnpm install --prod pnpm install --prod --lockfile-only
RUN --mount=type=cache,target=/root/.local/share/pnpm/store/v3 pnpm prune --prod
# === STAGE 3: Final Production Image === # === STAGE 3: Final Production Image ===
FROM arm64v8/node:22-alpine FROM arm64v8/node:22-alpine
@@ -67,4 +67,4 @@ COPY --from=builder /app/.output ./.output
EXPOSE 3000 EXPOSE 3000
CMD ["pnpm", "start"] CMD ["npm", "run", "start"]