Attempt 3 at fixing dockerfile
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
d663540ff2
commit
77ba5d05fc
|
|
@ -1,17 +1,25 @@
|
|||
FROM --platform=linux/amd64 node:20-bookworm-slim AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npx tsc --project tsconfig.json
|
||||
# Use a build argument for the platform to satisfy the warning
|
||||
ARG TARGETPLATFORM=linux/amd64
|
||||
FROM --platform=${TARGETPLATFORM} node:20-bookworm-slim
|
||||
|
||||
FROM --platform=linux/amd64 node:20-bookworm-slim
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# 1. Copy only the dependency files first (better caching)
|
||||
COPY package*.json ./
|
||||
RUN npm install --omit=dev
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=builder /app/config ./config
|
||||
|
||||
# 2. Install only production dependencies
|
||||
# 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
|
||||
|
||||
CMD ["node", "dist/scripts/update-space.js"]
|
||||
# 5. Run using tsx (already installed)
|
||||
CMD ["tsx", "scripts/update-space.ts"]
|
||||
Loading…
Reference in a new issue