Update dockerfile

This commit is contained in:
Arthur Belleville 2025-11-13 22:29:47 +01:00
parent 936f407282
commit 51252c2ac3
No known key found for this signature in database
3 changed files with 78 additions and 6 deletions

62
.dockerignore Normal file
View file

@ -0,0 +1,62 @@
# Dependencies
node_modules
.pnpm-store
# Build outputs
**/dist
**/build
**/.next
**/.nuxt
# Testing
**/__tests__
**/*.test.ts
**/*.test.js
**/*.spec.ts
**/*.spec.js
**/coverage
**/.vitest
# Environment files (should be injected at runtime)
**/.env
**/.env.*
!**/.env.example
# Development files
**/*.log
**/.DS_Store
**/npm-debug.log*
**/yarn-debug.log*
**/yarn-error.log*
**/pnpm-debug.log*
# IDE
**/.idea
**/.vscode
**/.vs
**/*.swp
**/*.swo
**/*~
# Git
.git
.gitignore
.gitattributes
# Documentation (not needed in production image)
**/*.md
!**/README.md
# CI/CD
.github
**/.gitlab-ci.yml
**/cloudbuild.yaml
**/.circleci
# Misc
**/.turbo
**/tsconfig.tsbuildinfo
**/.cache
**/tmp
**/temp

View file

@ -61,13 +61,17 @@ RUN pnpm install --frozen-lockfile --prod && pnpm store prune
# ==============================================================================
FROM base AS staging
# Copy production dependencies (from workspace root)
COPY --from=prod-deps /app/node_modules ./node_modules
# Copy built api application
COPY --from=build /app/apps/api/dist ./apps/api/dist
COPY --from=build /app/apps/api/package.json ./apps/api/package.json
# Copy shared packages (needed for workspace resolution)
COPY --from=prod-deps /app/packages ./packages
# Install production dependencies
# This ensures proper symlink structure for pnpm
RUN pnpm install --frozen-lockfile --prod --filter @xtablo/api...
# Set working directory to api app
WORKDIR /app/apps/api
@ -93,13 +97,17 @@ CMD ["pnpm", "start"]
# ==============================================================================
FROM base AS production
# Copy production dependencies (from workspace root)
COPY --from=prod-deps /app/node_modules ./node_modules
# Copy built api application
COPY --from=build /app/apps/api/dist ./apps/api/dist
COPY --from=build /app/apps/api/package.json ./apps/api/package.json
# Copy shared packages (needed for workspace resolution)
COPY --from=prod-deps /app/packages ./packages
# Install production dependencies
# This ensures proper symlink structure for pnpm
RUN pnpm install --frozen-lockfile --prod --filter @xtablo/api...
# Set working directory to api app
WORKDIR /app/apps/api

View file

@ -4,6 +4,7 @@
"skipLibCheck": true,
"target": "es2022",
"module": "NodeNext",
"rootDir": "./src",
"outDir": "./dist",
"allowJs": true,
"moduleDetection": "force",
@ -11,5 +12,6 @@
"verbatimModuleSyntax": true,
"types": ["node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}