Skip to content

✨ Add runner image with gpsgate CI tools baked in - #1

Merged
efrecon merged 7 commits into
mainfrom
feature/docker-image
Dec 2, 2026
Merged

efrecon merged 7 commits into
mainfrom
feature/docker-image

Conversation

@efrecon

@efrecon efrecon commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Jobs on our self-hosted runners download Python, .NET, pre-commit hooks, csharpier and semgrep each time.
This adds an image built on ghcr.io/efrecon/runner-krunvm-ubuntu with these baked in,
where gpsgate's workflows already look for them, so the workflows stay unchanged.
Mounting writable host caches would also be fast, but PR jobs could poison them for later jobs.

What is in the image

Tool Where
Python 3.12 /opt/hostedtoolcache, found by setup-python
.NET SDK 10 /usr/share/dotnet, found by setup-dotnet
pre-commit 4.6.0 and hook environments tool cache Python, ~/.cache/pre-commit
csharpier 1.2.5 ~/.dotnet/pre-commit/csharpier/1.2.5
semgrep 1.172.0, sarif-tools 3.0.5 ~/.venvs/semgrep
  • The larger steps are POSIX scripts under bin/.
  • precommit/ holds a skeleton of gpsgate's .pre-commit-config.yaml, only what keys the hook environments.
    --build-context precommit=<gpsgate checkout> overrides it.
  • MegaLinter is left out on purpose. A read-only podman image store at /usr/lib/containers/storage is enabled instead,
    to mount a store pre-pulled on the host. That part is untested.
  • The workflow builds on PRs, pushes latest and sha-* to GHCR from main, and rebuilds weekly without cache.

Testing

  • shellcheck -s sh clean.
  • Local build, also with the gpsgate checkout as build context.
  • With --network none, gpsgate's full config passes all hooks on a sample of gpsgate files, without downloads.
    The csharpier hook uses the baked binary even with PRE_COMMIT_HOOK_CSHARPIER_INSTALL: always.
  • Image is 6.08 GB against 3.4 GB for the base, uncompressed.
  • Not tested yet: this workflow, a real runner on the image, the MegaLinter store.

🤖 Generated with Claude Code

efrecon and others added 4 commits December 2, 2026 10:45
Jobs on self-hosted runners download Python, .NET, pre-commit hooks,
csharpier and semgrep each time. Baking them in an immutable image
makes jobs fast without writable host caches open to poisoning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Accept full Python versions in the semgrep step, check the image
store path, run setup.sh with bash, check dependencies early, keep
latest for main on the latest base and the Dockerfile description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The script runs as root at build time, so a silent upstream change
should not slip into the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A manual run from a branch named latest can overwrite the production runner image with a non-main build because branch tags are not isolated from reserved tags.

1 open issue
What changed in this PR

Adds a warmed-up self-hosted runner image to reduce repeated tool downloads in gpsgate CI without changing consuming workflows.

Changes:

  • Preinstalls Python, .NET, pre-commit hooks, csharpier, and analysis tools.
  • Adds image build, publishing, and weekly refresh automation.
  • Documents usage and an untested read-only MegaLinter image-store option.
File Description
README.md Documents tools, builds, runner usage, and cache isolation.
precommit/​README.md Explains hook configuration synchronization and overrides.
precommit/​.pre-commit-config.yaml Defines pinned hooks for warming environments.
Dockerfile Assembles the runner image and baked tool caches.
bin/​python.sh Installs Python into the runner tool cache.
bin/​pre-commit.sh Installs pre-commit, hook environments, and csharpier.
bin/​dotnet.sh Installs the .NET SDK for runner workflows.
.github/​workflows/​image.yml Builds, tags, publishes, and refreshes the image.

Review effort: Balanced

Comment thread .github/workflows/image.yml Resolved
efrecon and others added 2 commits December 2, 2026 11:17
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@efrecon
efrecon merged commit 8026ba8 into main Dec 2, 2026
1 check passed
@efrecon
efrecon deleted the feature/docker-image branch December 2, 2026 11:22
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.

2 participants