Fix Docker build: include scripts directory and tsx runtime
Problem: Docker container failed to start with REGENERATE_GIFS=true because scripts directory was not copied to production image and tsx was not available at runtime. Error: Cannot find module '/app/packages/backend/scripts/regenerate-all-gifs.ts' Root cause: 1. Dockerfile only copied dist/ and prisma/ directories, not scripts/ 2. tsx was in devDependencies, not available in production Solution: 1. Add COPY scripts directory in Dockerfile (line 69) 2. Move tsx from devDependencies to dependencies in package.json 3. Update pnpm-lock.yaml to reflect dependency change Changes: - Dockerfile: Added COPY --from=backend-builder scripts directory - package.json: Moved tsx@^4.7.0 to dependencies - pnpm-lock.yaml: Updated lockfile This allows the REGENERATE_GIFS environment variable to work correctly in production, enabling automatic GIF regeneration on container startup. Co-Authored-By: Auggie
This commit is contained in:
@@ -66,6 +66,7 @@ RUN pnpm install --frozen-lockfile
|
|||||||
# Copy backend build artifacts
|
# Copy backend build artifacts
|
||||||
COPY --from=backend-builder /app/packages/backend/dist ./packages/backend/dist
|
COPY --from=backend-builder /app/packages/backend/dist ./packages/backend/dist
|
||||||
COPY --from=backend-builder /app/packages/backend/prisma ./packages/backend/prisma
|
COPY --from=backend-builder /app/packages/backend/prisma ./packages/backend/prisma
|
||||||
|
COPY --from=backend-builder /app/packages/backend/scripts ./packages/backend/scripts
|
||||||
|
|
||||||
# Copy Prisma generated client (in pnpm workspace structure)
|
# Copy Prisma generated client (in pnpm workspace structure)
|
||||||
# We need to copy the entire .pnpm directory to preserve the Prisma client
|
# We need to copy the entire .pnpm directory to preserve the Prisma client
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"zod": "^3.22.4",
|
"zod": "^3.22.4",
|
||||||
"helmet": "^7.1.0",
|
"helmet": "^7.1.0",
|
||||||
"express-rate-limit": "^7.1.5"
|
"express-rate-limit": "^7.1.5",
|
||||||
|
"tsx": "^4.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
@@ -48,7 +49,6 @@
|
|||||||
"@typescript-eslint/parser": "^6.19.0",
|
"@typescript-eslint/parser": "^6.19.0",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"prisma": "^5.8.1",
|
"prisma": "^5.8.1",
|
||||||
"tsx": "^4.7.0",
|
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -59,6 +59,9 @@ importers:
|
|||||||
passport-microsoft:
|
passport-microsoft:
|
||||||
specifier: ^1.0.0
|
specifier: ^1.0.0
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
|
tsx:
|
||||||
|
specifier: ^4.7.0
|
||||||
|
version: 4.21.0
|
||||||
zod:
|
zod:
|
||||||
specifier: ^3.22.4
|
specifier: ^3.22.4
|
||||||
version: 3.25.76
|
version: 3.25.76
|
||||||
@@ -102,9 +105,6 @@ importers:
|
|||||||
prisma:
|
prisma:
|
||||||
specifier: ^5.8.1
|
specifier: ^5.8.1
|
||||||
version: 5.22.0
|
version: 5.22.0
|
||||||
tsx:
|
|
||||||
specifier: ^4.7.0
|
|
||||||
version: 4.21.0
|
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.3.3
|
specifier: ^5.3.3
|
||||||
version: 5.9.3
|
version: 5.9.3
|
||||||
|
|||||||
Reference in New Issue
Block a user