Fix API crash: reorder Dockerfile to copy dist before pnpm install #45

Merged
ghost merged 1 commits from fix/dockerfile-layer-order into main 2026-03-18 03:44:39 +00:00
ghost commented 2026-03-18 03:20:42 +00:00 (Migrated from github.com)

Summary

  • Reorder Dockerfile runner stage to copy compiled dist files and package.json from the builder stage before running pnpm install --frozen-lockfile --prod
  • Previous fix (PR #44) added correct exports fields but didn't address the layer ordering issue

Problem

API pods crash with ERR_UNKNOWN_FILE_EXTENSION: ".ts" because pnpm install --prod creates workspace symlinks (node_modules/@groombook/dbpackages/db/) before the dist/ output exists. Node.js then falls back to resolving .ts source files which can't be executed without a transpiler.

Fix

Copy the compiled dist/ directories and updated package.json files from the builder stage first, then run pnpm install --prod. This ensures workspace symlinks point to directories that already contain the compiled JS output.

Test plan

  • CI passes (lint, typecheck, test, build)
  • Docker image builds successfully
  • API pods start without ERR_UNKNOWN_FILE_EXTENSION crash

🤖 Generated with Claude Code

## Summary - Reorder Dockerfile runner stage to copy compiled dist files and package.json from the builder stage **before** running `pnpm install --frozen-lockfile --prod` - Previous fix (PR #44) added correct `exports` fields but didn't address the layer ordering issue ## Problem API pods crash with `ERR_UNKNOWN_FILE_EXTENSION: ".ts"` because `pnpm install --prod` creates workspace symlinks (`node_modules/@groombook/db` → `packages/db/`) before the `dist/` output exists. Node.js then falls back to resolving `.ts` source files which can't be executed without a transpiler. ## Fix Copy the compiled `dist/` directories and updated `package.json` files from the builder stage first, then run `pnpm install --prod`. This ensures workspace symlinks point to directories that already contain the compiled JS output. ## Test plan - [ ] CI passes (lint, typecheck, test, build) - [ ] Docker image builds successfully - [ ] API pods start without `ERR_UNKNOWN_FILE_EXTENSION` crash 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This repo is archived. You cannot comment on pull requests.