Repository navigation
Deploy in about a minute: pull CI-built images instead of building on the VPS - #3
Merged
Merged
Conversation
… VPS
- Push every image to ghcr.io/<repo>/<name>:<commit> from the images job on main, reusing its build cache
- Name compose images ${IMAGE_REGISTRY:-o11y}/<name>:${IMAGE_TAG:-local}, so local builds keep working
- Make infra/deploy.sh pull and start with --no-build when IMAGE_TAG is set, and build only when run by hand without it
- Log the VPS into GHCR with the deploy job's short-lived token and log out when done
- Remove this stack's images from earlier deploys after each pull, leaving other images on the machine alone
- Document the faster deploy and the manual path in infra/README.md
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.
Why
The deploy job ran
docker compose build --pullon the VPS: all 14 images, including three Rust servers, compiled on a 2-core, 4 GB machine that is also serving the stack and other sites. The deploy for PR #2 was still building after 27 minutes, while CI had already built every image on GitHub's runners minutes earlier.What changes
main, also pushes each image toghcr.io/rshdhere/load-test/<name>:<commit>. It reuses the build cache from the step before, so this is mostly an upload.${IMAGE_REGISTRY:-o11y}/<name>:${IMAGE_TAG:-local}, so localdocker compose up --buildis unchanged.IMAGE_TAGset it runscompose pullandup --no-build, then deletes this stack's images from earlier deploys (only those, so other images on the machine are untouched). Without it, it still builds, for manual use.GITHUB_TOKEN(packages: read, valid only while the job runs), deploys, and logs out. No long-lived credential on the VPS; works whether or not the packages are public.Notes
up, so the running stack keeps serving the previous version.maincreates the GHCR packages.