diff --git a/Dockerfile b/Dockerfile index 2f85905..fc5b6e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,21 +6,25 @@ FROM node:22-alpine AS builder # Install system dependencies for sharp and pdf processing RUN apk add --no-cache \ python3 \ + py3-pip \ make \ g++ \ + gcc \ + libc-dev \ + vips-dev \ poppler-utils \ - vips-dev + pkgconfig WORKDIR /app -# Install pnpm -RUN npm install -g pnpm@10.4.1 +# Install pnpm and node-gyp globally +RUN npm install -g pnpm@10.4.1 node-gyp # Copy package files COPY package.json pnpm-lock.yaml ./ COPY patches/ ./patches/ -# Install dependencies +# Install dependencies (with node-gyp available) RUN pnpm install --frozen-lockfile # Copy source code @@ -42,15 +46,18 @@ RUN apk add --no-cache \ WORKDIR /app -# Install pnpm for production deps +# Install pnpm RUN npm install -g pnpm@10.4.1 # Copy package files COPY package.json pnpm-lock.yaml ./ COPY patches/ ./patches/ -# Install production dependencies only -RUN pnpm install --frozen-lockfile --prod +# Install production dependencies only (no build tools needed for prod deps) +RUN apk add --no-cache python3 make g++ gcc libc-dev vips-dev pkgconfig && \ + npm install -g node-gyp && \ + pnpm install --frozen-lockfile --prod && \ + apk del make g++ gcc libc-dev pkgconfig # Copy built assets from builder COPY --from=builder /app/dist ./dist