Attempt 3 at fixing dockerfile
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
GeorgeWebberley 2026-01-29 07:45:53 +01:00
parent d663540ff2
commit 77ba5d05fc

View file

@ -1,17 +1,25 @@
FROM --platform=linux/amd64 node:20-bookworm-slim AS builder # Use a build argument for the platform to satisfy the warning
WORKDIR /app ARG TARGETPLATFORM=linux/amd64
COPY package*.json ./ FROM --platform=${TARGETPLATFORM} node:20-bookworm-slim
RUN npm install
COPY . .
RUN npx tsc --project tsconfig.json
FROM --platform=linux/amd64 node:20-bookworm-slim
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
# 1. Copy only the dependency files first (better caching)
COPY package*.json ./ COPY package*.json ./
RUN npm install --omit=dev
COPY --from=builder /app/dist ./dist # 2. Install only production dependencies
COPY --from=builder /app/config ./config # This keeps the image small
RUN npm install --omit=dev && npm install -g tsx
# 3. Copy only the folders the worker actually needs
# This avoids copying the massive .next or .git folders
COPY scripts ./scripts
COPY lib ./lib
COPY config ./config
# 4. Create data directory
RUN mkdir -p /app/data RUN mkdir -p /app/data
CMD ["node", "dist/scripts/update-space.js"] # 5. Run using tsx (already installed)
CMD ["tsx", "scripts/update-space.ts"]