Self-host Shields.io to render badges for your projects. The image uses the upstream tagged server release, runs as the node user, and serves HTTP on port 80. The release workflow builds for linux/amd64 and linux/arm64.
docker run --rm --name shields -p 127.0.0.1:8080:80 beevelop/shields:latestOpen a sample SVG badge to verify the server. Pin a specific image tag or digest in production.
Clone this repository and use Docker Compose v2.24 or newer. Compose builds Shields from the checkout and publishes the Varnish frontend on loopback by default.
docker compose up --build --wait
curl -fsS http://127.0.0.1:8080/badge/self_hosted-passing-brightgreen.svgSet SHIELDS_HOST_PORT and SHIELDS_BIND_ADDR to override the frontend mapping. Set VIRTUAL_HOST if an existing reverse proxy uses it for discovery. The Varnish service reaches Shields on the Compose network at shields:80.
Pass settings using docker run --env-file or create an optional shields.env file beside docker-compose.yml. Keep credential files private.
| Variable | Behavior |
|---|---|
INFOSITE |
Legacy root redirect. Defaults to http://shields.io. Set it to an empty value to let Shields serve its local homepage. |
REDIRECT_URI |
Upstream root redirect. A nonempty value takes precedence over INFOSITE. |
GH_TOKEN |
Optional GitHub token for badge lookups, with only the permissions your badges need. |
GH_CLIENT_ID, GH_CLIENT_SECRET |
Legacy GitHub OAuth settings. Leave them unset for anonymous use. Most self-hosted instances use GH_TOKEN for authenticated GitHub requests. |
RASTER_URL |
Optional URL of a separately hosted raster server. Shields redirects PNG badge requests there. |
DYNAMIC_AND_ENDPOINT_BADGES_ENABLED |
Set to false on public deployments that can reach private network resources to disable badges that fetch requester-provided URLs. |
See the upstream self-hosting guide and server secrets reference for additional options. For a direct container run, use PORT and a matching port mapping if your platform requires an unprivileged listener such as 8080. The included Compose stack uses port 80 internally.
Existing SVG badge URLs and host mappings to container port 80 continue to work. Use a sample badge or set INFOSITE= to reach the frontend at / in place of the old /try.html page. For PNG output, deploy a compatible Squint raster server, point it at this Shields instance using its BASE_URL, and set the Shields RASTER_URL to the raster server URL.
The stack uses Docker Compose networking and the official Varnish image. Migrate old Docker links to the Compose service name or a shared Docker network. Credentials are consumed from the upstream environment settings.
docker build -t shields:local .
bash .github/scripts/smoke.sh shields:localGitHub Actions verifies both architectures and the Compose stack on pull requests. Default-branch builds publish beevelop/shields:latest after validation.
For a versioned release, push a Git tag in the CalVer format vYYYY.MM.MICRO, such as v2026.12.1. Start at 1 for the first release of the month and increment MICRO for each additional release that month. The workflow publishes the same tag on Docker Hub for linux/amd64 and linux/arm64. Publishing uses the repository's DOCKERHUB_USERNAME and DOCKERHUB_TOKEN Actions secrets.
| Badge | Docker Hub | Build Status | Published | Release / Tag | License |
|---|---|---|---|---|---|
