From fb0f6b5b62303834079648dff9bf369206d054ab Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sun, 1 Feb 2026 01:37:30 -0600 Subject: [PATCH] fix(docker): Fix module resolution and healthcheck syntax Issues fixed: 1. Module not found: Added missing copy of apps/{api,web}/node_modules which contains pnpm symlinks to the root node_modules 2. Healthcheck syntax: Fixed broken quoting from prettier reformatting Changed to CMD-SHELL with proper escaping 3. Removed obsolete version: "3.9" from docker-compose.yml The apps need their own node_modules directories because pnpm uses symlinks that point from apps/*/node_modules to node_modules/.pnpm/* Co-Authored-By: Claude Opus 4.5 --- apps/api/Dockerfile | 2 ++ apps/web/Dockerfile | 2 ++ docker-compose.yml | 14 ++++---------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index c5cca1d..f2fc72c 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -73,6 +73,8 @@ COPY --from=builder --chown=nestjs:nodejs /app/packages ./packages COPY --from=builder --chown=nestjs:nodejs /app/apps/api/dist ./apps/api/dist COPY --from=builder --chown=nestjs:nodejs /app/apps/api/prisma ./apps/api/prisma COPY --from=builder --chown=nestjs:nodejs /app/apps/api/package.json ./apps/api/ +# Copy app's node_modules which contains symlinks to root node_modules +COPY --from=builder --chown=nestjs:nodejs /app/apps/api/node_modules ./apps/api/node_modules # Set working directory to API app WORKDIR /app/apps/api diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 03232d6..c1eeb86 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -83,6 +83,8 @@ COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next ./apps/web/.next COPY --from=builder --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public COPY --from=builder --chown=nextjs:nodejs /app/apps/web/next.config.ts ./apps/web/ COPY --from=builder --chown=nextjs:nodejs /app/apps/web/package.json ./apps/web/ +# Copy app's node_modules which contains symlinks to root node_modules +COPY --from=builder --chown=nextjs:nodejs /app/apps/web/node_modules ./apps/web/node_modules # Set working directory to web app WORKDIR /app/apps/web diff --git a/docker-compose.yml b/docker-compose.yml index 10f2709..4292a89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.9" - services: # ====================== # PostgreSQL Database @@ -328,10 +326,8 @@ services: healthcheck: test: [ - "CMD", - "sh", - "-c", - 'node -e "require(''http'').get(''http://localhost:${PORT:-3001}/health'', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"', + "CMD-SHELL", + 'node -e "require(''http'').get(''http://localhost:${API_PORT:-3001}/health'', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"', ] interval: 30s timeout: 10s @@ -376,10 +372,8 @@ services: healthcheck: test: [ - "CMD", - "sh", - "-c", - 'node -e "require(''http'').get(''http://localhost:${PORT:-3000}'', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"', + "CMD-SHELL", + 'node -e "require(''http'').get(''http://localhost:${WEB_PORT:-3000}'', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"', ] interval: 30s timeout: 10s