Skip to content

Optimize Docker build and harden production image - #1391

Merged
LunaUrsa merged 1 commit into
uatfrom
codex/optimize-docker-build
Nov 15, 2026
Merged

LunaUrsa merged 1 commit into
uatfrom
codex/optimize-docker-build

Conversation

@LunaUrsa

Copy link
Copy Markdown
Contributor

The previous production build inherited development tooling, repeated dependency installation and Prisma generation, and admitted local secrets into its build context. Separate the build stages, cache npm downloads, prune development dependencies, and copy only runtime files.

Keep Node 22 and Debian Bookworm consistent across stages, pin PM2, install OpenSSL explicitly, and run production as the node user with writable runtime assets. Preserve startup migrations and command registration behavior.

Validation:

  • Development and production Docker targets built successfully.
  • Isolated container smoke test passed: non-root UID, native modules and Prisma clients, excluded local secrets/test dependencies, and writable runtime data.
  • TypeScript, targeted ESLint, and git diff --check passed.
  • Added an opt-in Vitest smoke test enabled with TRIPBOT_TEST_IMAGE=tripbot:docker-review.

The visible production filesystem is about 930 MiB, including 594 MiB of dependencies. Prisma CLI remains for startup migrations. No bot startup or database migrations were performed.

@LunaUrsa
LunaUrsa requested a review from a team as a code owner November 14, 2026 20:16
@LunaUrsa
LunaUrsa merged commit 42b3aae into uat Nov 15, 2026
12 checks passed
@LunaUrsa
LunaUrsa deleted the codex/optimize-docker-build branch November 15, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant