chore: publish the backend image to GitHub Container Registry (#85) - #84
Merged
Conversation
The backend image was published to a registry account outside the lobx-platform organisation, so deployment depended on an account the organisation does not control. The org already owns this repository, so the image now lives in its own registry alongside the code. Deploy-time authentication uses the workflow's own token, which is scoped to the run and expires with it, and the job logs out explicitly afterwards. Containers restart from the local image rather than re-pulling, so a pull only happens while a deploy is running. Also make a failed pull fatal. deploy.sh previously ignored the failure and continued with whatever image was already present, so a deploy that shipped nothing was indistinguishable from one that worked: the service kept running and the run reported success. Finally, align back/.dockerignore with the repo-root ignore rules. The image is built with ./back as its context, so the root file never applied to it and the two had drifted apart. CI was unaffected, since the relevant files are gitignored and a fresh checkout does not contain them; local builds were not. Verified by building from a local working copy that does contain files matching the root file's patterns. None appear in the resulting image, and a scan of the image tree finds no key material. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dthinkr
force-pushed
the
chore/ghcr-migration
branch
from
September 9, 2026 09:59
720ff1c to
ae5ad90
Compare
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.
Ref #85
Why
The backend image was published to a registry account outside
lobx-platform, so deployment depended on an account the organisation does not control. Since the org already owns this repository, the image can live in its own registry instead.What changed
.github/workflows/docker-build-push.ymlghcr.io/lobx-platform/trading_platform; the deploy job authenticates with the workflow's own token and logs out afterwardsdocker-compose.server.ymldeploy.shback/.dockerignoreBefore / after
Registry ownership
ghcr.io/lobx-platform/trading_platformGITHUB_TOKEN, valid only for that runA failed pull
before:
Exit code 0. The run reports success even though nothing new was deployed.
after:
Exit code 1. The deploy fails visibly.
Build context ignore rules
The image is built with
./backas its context, so the repo-root.dockerignorenever applied to it and the two files had drifted apart. Verified by building from a local working copy that contains files matching the root file's credential patterns: none of them appear in the resulting image, and a scan of the image tree finds no key material. CI was already unaffected, since those files are gitignored and a fresh checkout does not contain them.Credential handling at deploy time
secrets.GITHUB_TOKENis scoped to the run and expires when the job ends, and the job logs out explicitly. Containers userestart: unless-stopped, so a restart reuses the local image rather than pulling; a pull only happens during a deploy, while that token is present.Before merging
The package is created by the first push. Once the first run on
maincompletes, check the package's visibility and repository link under the organisation's package settings and set them as intended.DOCKERHUB_USERNAMEandDOCKERHUB_TOKENare no longer referenced and can be removed from the repository secrets.Note
Merging triggers a real deployment.
🤖 Generated with Claude Code