feat: Add vips dependencies for sharp in backend Dockerfile
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- Added `vips-dev` and `vips` to build and runtime dependencies.
- Updated installation process to ensure compilation
This commit is contained in:
2025-12-09 18:00:32 +01:00
parent 7c96a15c2e
commit ccc5c028ba

View File

@ -25,14 +25,19 @@ FROM node:20-alpine
WORKDIR /app WORKDIR /app
# Install runtime dependencies (git for simple-git, sqlite3 CLI tool, vips for sharp) # 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 # Note: python3, make, g++ are needed for native module compilation
RUN apk add --no-cache git sqlite vips vips-dev python3 make g++
# Copy package files first # Copy package files first
COPY --from=builder /app/package*.json ./ COPY --from=builder /app/package*.json ./
# Install production dependencies (will compile native modules in this stage) # Rebuild sharp for the correct architecture (linuxmusl-x64)
# Install all production dependencies
RUN npm ci --omit=dev || npm install --production RUN npm ci --omit=dev || npm install --production
# Clean up build dependencies after installation to reduce image size
RUN apk del python3 make g++ vips-dev
# Copy built files from builder # Copy built files from builder
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY --from=builder /app/src/db/migrations ./dist/db/migrations COPY --from=builder /app/src/db/migrations ./dist/db/migrations