fix: swap bun install for npm ci to fix integrity check failures
Known Bun bug (oven-sh/bun#1590, #26879, #18864) causes IntegrityCheckFailed during tarball extraction in Docker/CI. This is a 3+ year old issue with no fix in sight. Changes: - Generate package-lock.json via npm install --package-lock-only - Dockerfile: add nodejs npm to all stages, replace bun install with npm ci --legacy-peer-deps (peer dep conflict exists for eslint@8 with eslint-config-next@16) - Keep bun as runtime (bun test, bun run build, bun run start) - pr.yml: npm ci, npx prisma generate, npx playwright - release.yml: node scripts, npm test - build-ci-images.yml: add package-lock.json trigger path
This commit is contained in:
+11
-11
@@ -4,7 +4,7 @@
|
||||
FROM oven/bun:alpine AS builder
|
||||
|
||||
# Install dependencies (needed for native modules)
|
||||
RUN apk add --no-cache python3 make g++
|
||||
RUN apk add --no-cache python3 make g++ nodejs npm
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
@@ -13,14 +13,14 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies (including dev dependencies for building)
|
||||
RUN bun install --retry 3
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Generate Prisma client (with dummy PostgreSQL DATABASE_URL for build-time generation)
|
||||
# Note: A dummy URL is used since the real database is not available during build
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" bun x prisma generate
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||
|
||||
# Build the application (with dummy DATABASE_URL for static page generation and git commit)
|
||||
ARG GIT_COMMIT=unknown
|
||||
@@ -30,7 +30,7 @@ RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:
|
||||
FROM oven/bun:alpine AS test-runner
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache python3 make g++ git
|
||||
RUN apk add --no-cache python3 make g++ git nodejs npm
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
@@ -39,19 +39,19 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install ALL dependencies (including dev dependencies for testing)
|
||||
RUN bun install --retry 3
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Generate Prisma client
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" bun x prisma generate
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||
|
||||
# Stage 3: Production runner
|
||||
FROM oven/bun:alpine AS runner
|
||||
|
||||
# Install dumb-init for proper signal handling
|
||||
RUN apk add --no-cache dumb-init
|
||||
# Install dumb-init and npm for production install
|
||||
RUN apk add --no-cache dumb-init nodejs npm
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup --system --gid 1001 euchre && \
|
||||
@@ -64,15 +64,15 @@ WORKDIR /app
|
||||
COPY --from=builder --chown=euchre:euchre /app/.next ./.next
|
||||
COPY --from=builder --chown=euchre:euchre /app/public ./public
|
||||
COPY --from=builder --chown=euchre:euchre /app/package.json ./package.json
|
||||
COPY --from=builder --chown=euchre:euchre /app/bun.lock ./bun.lock
|
||||
COPY --from=builder --chown=euchre:euchre /app/package-lock.json ./package-lock.json
|
||||
COPY --from=builder --chown=euchre:euchre /app/prisma ./prisma
|
||||
|
||||
# Install only production dependencies
|
||||
RUN bun install --retry 3 --production
|
||||
RUN npm ci --legacy-peer-deps --omit=dev
|
||||
|
||||
# Generate Prisma client
|
||||
# Note: We need to set DATABASE_URL even for generation because prisma.config.ts requires it
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" bun x prisma generate
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||
|
||||
# Switch to non-root user
|
||||
USER euchre
|
||||
|
||||
Reference in New Issue
Block a user