From 7c96a15c2e84fc20e367a37715cc6b5a199bd10b Mon Sep 17 00:00:00 2001 From: Kenzo Date: Tue, 9 Dec 2025 17:58:21 +0100 Subject: [PATCH] feat: Add vips dependencies for sharp in backend Dockerfile - Added `vips-dev` and `vips` to build and runtime dependencies. - Updated installation process to ensure compilation of native modules during build. --- backend/Dockerfile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 15f438c..1b608bc 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -5,8 +5,8 @@ FROM node:20-alpine AS builder WORKDIR /app -# Install build dependencies for native modules (better-sqlite3) -RUN apk add --no-cache python3 make g++ +# Install build dependencies for native modules (better-sqlite3, sharp) +RUN apk add --no-cache python3 make g++ vips-dev # Install dependencies COPY package*.json ./ @@ -24,11 +24,14 @@ FROM node:20-alpine WORKDIR /app -# Install runtime dependencies (git for simple-git, sqlite3 CLI tool) -RUN apk add --no-cache git sqlite +# Install runtime dependencies (git for simple-git, sqlite3 CLI tool, vips for sharp) +RUN apk add --no-cache git sqlite vips python3 make g++ vips-dev -# Copy production dependencies from builder (already compiled native modules) -COPY --from=builder /app/node_modules ./node_modules +# Copy package files first +COPY --from=builder /app/package*.json ./ + +# Install production dependencies (will compile native modules in this stage) +RUN npm ci --omit=dev || npm install --production # Copy built files from builder COPY --from=builder /app/dist ./dist