build(jobnik-manager): build the image from a pruned workspace - #7
Open
CptSchnitz wants to merge 1 commit into
Open
build(jobnik-manager): build the image from a pruned workspace#7CptSchnitz wants to merge 1 commit into
CptSchnitz wants to merge 1 commit into
Conversation
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>
Coverage Report for apps/jobnik-manager
File CoverageNo changed files found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 CLI • Give Feedback 💬