fix: Dockerfile - add node-gyp for sharp compilation
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -6,21 +6,25 @@ FROM node:22-alpine AS builder
|
|||||||
# Install system dependencies for sharp and pdf processing
|
# Install system dependencies for sharp and pdf processing
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
python3 \
|
python3 \
|
||||||
|
py3-pip \
|
||||||
make \
|
make \
|
||||||
g++ \
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-dev \
|
||||||
|
vips-dev \
|
||||||
poppler-utils \
|
poppler-utils \
|
||||||
vips-dev
|
pkgconfig
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install pnpm
|
# Install pnpm and node-gyp globally
|
||||||
RUN npm install -g pnpm@10.4.1
|
RUN npm install -g pnpm@10.4.1 node-gyp
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
COPY patches/ ./patches/
|
COPY patches/ ./patches/
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies (with node-gyp available)
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
@@ -42,15 +46,18 @@ RUN apk add --no-cache \
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install pnpm for production deps
|
# Install pnpm
|
||||||
RUN npm install -g pnpm@10.4.1
|
RUN npm install -g pnpm@10.4.1
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
COPY patches/ ./patches/
|
COPY patches/ ./patches/
|
||||||
|
|
||||||
# Install production dependencies only
|
# Install production dependencies only (no build tools needed for prod deps)
|
||||||
RUN pnpm install --frozen-lockfile --prod
|
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 built assets from builder
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|||||||
Reference in New Issue
Block a user