Skip to content

chore: publish the backend image to GitHub Container Registry (#85) - #84

Merged
dthinkr merged 1 commit into
mainfrom
chore/ghcr-migration
Sep 9, 2026
Merged

chore: publish the backend image to GitHub Container Registry (#85)#84
dthinkr merged 1 commit into
mainfrom
chore/ghcr-migration

Conversation

@dthinkr

@dthinkr dthinkr commented Sep 9, 2026

Copy link
Copy Markdown
Member

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

File Change
.github/workflows/docker-build-push.yml Build and push to ghcr.io/lobx-platform/trading_platform; the deploy job authenticates with the workflow's own token and logs out afterwards
docker-compose.server.yml Image reference updated
deploy.sh A failed image pull is now fatal instead of ignored
back/.dockerignore Aligned with the repo-root ignore rules

Before / after

Registry ownership

before after
Image source a registry account outside the org ghcr.io/lobx-platform/trading_platform
Registry credential used at deploy a long-lived token held as a repository secret the workflow's own GITHUB_TOKEN, valid only for that run
Left behind after the deploy persists removed by an explicit logout

A failed pull

before:

Pulling backend image...
Backend image pull failed; continuing with any existing local image
Starting services...

Exit code 0. The run reports success even though nothing new was deployed.

after:

Pulling backend image...
ERROR: could not pull the backend image from the registry.
Refusing to continue, because doing so would silently redeploy the previous version.

Exit code 1. The deploy fails visibly.

Build context ignore rules

The image is built with ./back as its context, so the repo-root .dockerignore never 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_TOKEN is scoped to the run and expires when the job ends, and the job logs out explicitly. Containers use restart: 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 main completes, check the package's visibility and repository link under the organisation's package settings and set them as intended.

DOCKERHUB_USERNAME and DOCKERHUB_TOKEN are no longer referenced and can be removed from the repository secrets.

Note

Merging triggers a real deployment.

🤖 Generated with Claude Code

@dthinkr dthinkr changed the title chore: publish the backend image to GitHub Container Registry chore: publish the backend image to GitHub Container Registry (#85) Sep 9, 2026
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>
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