diff --git a/Dockerfile b/Dockerfile index 73f308a..4ee4748 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,19 @@ RUN curl -fsSL https://bun.sh/install | bash -s "bun-v1.3.11" \ FROM base AS prod-deps WORKDIR /app COPY package.json bun.lock ./ -RUN bun install --production --frozen-lockfile +# Retry with a fresh cache dir per attempt: a corrupt tarball download +# (flaky registry/proxy → "Integrity check failed for tarball: drizzle-kit") +# must never be reused from a bun cache, across attempts or cached layers. +RUN for i in 1 2 3; do \ + rm -rf /tmp/bun-cache; \ + if bun install --production --frozen-lockfile --cache-dir=/tmp/bun-cache; then \ + exit 0; \ + fi; \ + echo "bun install (production) attempt $i/3 failed, retrying in 5s..."; \ + sleep 5; \ + done; \ + echo "bun install (production) failed after 3 attempts"; \ + exit 1 # ─────────────────────────── builder ───────────────────────────── # Full install (incl. devDeps) + Next.js standalone build. @@ -56,7 +68,18 @@ FROM base AS builder RUN apk add --no-cache git WORKDIR /app COPY package.json bun.lock ./ -RUN bun install --frozen-lockfile +# Same retry + fresh-cache pattern as prod-deps (corrupt tarball downloads +# fail bun's integrity check; a fresh --cache-dir per attempt prevents reuse). +RUN for i in 1 2 3; do \ + rm -rf /tmp/bun-cache; \ + if bun install --frozen-lockfile --cache-dir=/tmp/bun-cache; then \ + exit 0; \ + fi; \ + echo "bun install attempt $i/3 failed, retrying in 5s..."; \ + sleep 5; \ + done; \ + echo "bun install failed after 3 attempts"; \ + exit 1 COPY . . # next.config.mjs requires `output: "standalone"` (already set). # `bun run build` == `bun run generate:version-info && next build --webpack`.