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