Skip to content

build(jobnik-manager): build the image from a pruned workspace - #7

Open
CptSchnitz wants to merge 1 commit into
migration/04-openapi-packagefrom
migration/05-container-image
Open

build(jobnik-manager): build the image from a pruned workspace#7
CptSchnitz wants to merge 1 commit into
migration/04-openapi-packagefrom
migration/05-container-image

Conversation

@CptSchnitz

Copy link
Copy Markdown
Collaborator

Replace the single-repo Dockerfile with a shared, workspace-aware
definition at docker/backend.Dockerfile, following the reference
monorepo's backend image (minus its policy-engine download): prune
the workspace to the manager with turbo, install from a pnpm store
cache mount, build through turbo, then pnpm deploy only production
dependencies into the runtime image.

The runtime base image stays node:24-alpine, since the generated
Prisma client already targets its libc, and the migration
command-line tool is still pulled into the image via npx as the
final build step. That step now pins the major version
(npx prisma@6, matching the manager's own ^6.19.0 dependency) because
an unpinned npx now resolves Prisma 7, which dropped support for the
datasource url field this schema still uses -- caught by actually
building the image and running the migration against a throwaway
database, which is also this ticket's own verification.

pnpm deploy only carries a workspace package's dist output when the
package declares a files field (jobnik-manager never needed one
before, since it was git-cloned and built in place); without it, the
deploy silently dropped dist. Added files: ["dist/**/*"], matching
jobnik-openapi's existing convention.

While rebuilding dist standalone to verify the above, found that
assets:copy's migrations copyfiles invocation has been silently
flattening the migrations directory (copyfiles -f with an unquoted
glob loses recursion under the shell it runs in) and dropping every
migration file except migration_lock.toml. The old Dockerfile never
noticed because it copied migrations from source directly, bypassing
dist; now that dist is the deployed artifact, the copy had to be
fixed so 'prisma migrate deploy' has something to apply.

jobnik-manager also declares which Dockerfile builds it
(dockerfile field) so a future build matrix can find it without
anything hardcoded, and its own build:docker script now follows the
reference monorepo's convention of invoking docker buildx directly,
replacing a tsc-based script of the same name that no longer applied
under the new build and was never actually wired into the old
Dockerfile either.

Left a comment on ticket 06 flagging that its migration-runner
compose command needs the same prisma@6 pin.

Refs: .scratch/monorepo-migration/issues/05-container-image-pruned-workspace.md

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com


Stack created with GitHub Stacks CLIGive Feedback 💬

Replace the single-repo Dockerfile with a shared, workspace-aware
definition at docker/backend.Dockerfile, following the reference
monorepo's backend image (minus its policy-engine download): prune
the workspace to the manager with turbo, install from a pnpm store
cache mount, build through turbo, then pnpm deploy only production
dependencies into the runtime image.

The runtime base image stays node:24-alpine, since the generated
Prisma client already targets its libc, and the migration
command-line tool is still pulled into the image via npx as the
final build step. That step now pins the major version
(npx prisma@6, matching the manager's own ^6.19.0 dependency) because
an unpinned npx now resolves Prisma 7, which dropped support for the
datasource url field this schema still uses -- caught by actually
building the image and running the migration against a throwaway
database, which is also this ticket's own verification.

pnpm deploy only carries a workspace package's dist output when the
package declares a files field (jobnik-manager never needed one
before, since it was git-cloned and built in place); without it, the
deploy silently dropped dist. Added files: ["dist/**/*"], matching
jobnik-openapi's existing convention.

While rebuilding dist standalone to verify the above, found that
assets:copy's migrations copyfiles invocation has been silently
flattening the migrations directory (copyfiles -f with an unquoted
glob loses recursion under the shell it runs in) and dropping every
migration file except migration_lock.toml. The old Dockerfile never
noticed because it copied migrations from source directly, bypassing
dist; now that dist is the deployed artifact, the copy had to be
fixed so 'prisma migrate deploy' has something to apply.

jobnik-manager also declares which Dockerfile builds it
(dockerfile field) so a future build matrix can find it without
anything hardcoded, and its own build:docker script now follows the
reference monorepo's convention of invoking docker buildx directly,
replacing a tsc-based script of the same name that no longer applied
under the new build and was never actually wired into the old
Dockerfile either.

Left a comment on ticket 06 flagging that its migration-runner
compose command needs the same prisma@6 pin.

Refs: .scratch/monorepo-migration/issues/05-container-image-pruned-workspace.md

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Coverage Report for apps/jobnik-manager

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 80%) 767 / 767
🟢 Statements 100% (🎯 80%) 784 / 784
🟢 Functions 100% (🎯 80%) 112 / 112
🟢 Branches 100% (🎯 80%) 219 / 219
File CoverageNo changed files found.
Generated in workflow #3 for commit 40794c0 by the Vitest Coverage Report Action

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