diff --git a/worker/Dockerfile b/worker/Dockerfile index 4fd5572..1ffe447 100644 --- a/worker/Dockerfile +++ b/worker/Dockerfile @@ -1,16 +1,17 @@ ### Multi-stage build: compile TypeScript in a builder image, produce a smaller runtime image -### IMPORTANT: Dokploy will set build context to worker/ directory automatically -### All COPY paths must be relative to worker/ (use ../ to access parent repo root) +### IMPORTANT: Dokploy must set dockerContextPath="." (repo root) in database +### This allows the build to access package.json and other files from repo root +### Dockerfile path should be "worker/Dockerfile" FROM node:20 AS builder WORKDIR /usr/src/app -# Copy package manifests from parent directory and install all deps (including dev) for build -COPY ../package.json ../package-lock.json ./ +# Copy package manifests and install all deps (including dev) for build +COPY package.json package-lock.json ./ RUN npm ci --silent -# Copy entire project from parent directory and compile TypeScript -COPY ../ . +# Copy entire project and compile TypeScript +COPY . . # Try to compile the project; if there is no TS config for worker, keep files as-is RUN npx tsc -p tsconfig.json --outDir dist || echo "tsc exit code ignored" @@ -18,7 +19,7 @@ FROM node:20-alpine AS runner WORKDIR /usr/src/app # Install only production dependencies -COPY ../package.json ../package-lock.json ./ +COPY package.json package-lock.json ./ RUN npm ci --production --silent # Copy compiled output from builder (if present) and essential runtime files