fix: Dockerfile - add node-gyp for sharp compilation

This commit is contained in:
Manus Deploy
2026-04-28 12:24:12 -04:00
parent 1ddb715eda
commit cdd8aabf39

View File

@@ -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