Fix Docker build issues
- Add git to build dependencies (required by some npm packages) - Add build-time environment variables (NEXT_PUBLIC_VAPID_PUBLIC_KEY, BETTER_AUTH_SECRET, BETTER_AUTH_URL) - Add error output capture (2>&1) to expose build errors - Ensure all dependencies are available during build phase
This commit is contained in:
+8
-3
@@ -5,21 +5,26 @@ WORKDIR /app
|
||||
|
||||
# Install dependencies stage
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
RUN apk add --no-cache libc6-compat git
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
||||
RUN pnpm install --frozen-lockfile --prod
|
||||
|
||||
# Build stage
|
||||
FROM base AS builder
|
||||
RUN apk add --no-cache libc6-compat postgresql-client
|
||||
RUN apk add --no-cache libc6-compat git postgresql-client
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Set required build-time environment variables
|
||||
ENV NEXT_PUBLIC_VAPID_PUBLIC_KEY=dummy_key_for_build
|
||||
ENV BETTER_AUTH_SECRET=dummy_secret_for_build
|
||||
ENV BETTER_AUTH_URL=http://localhost:3000
|
||||
|
||||
# Build the app
|
||||
RUN pnpm build
|
||||
RUN pnpm build 2>&1
|
||||
|
||||
# Production runtime
|
||||
FROM base AS runtime
|
||||
|
||||
Reference in New Issue
Block a user