Generate short-lived GitHub App installation tokens from a minimal Docker container
3.2K
Tags follow the pattern <python>-<distro> for every
actively maintained CPython version.
End-of-life versions are removed automatically.
| Pattern | Example | Description |
|---|---|---|
latest | Newest Python + slim (recommended) | |
<python>-slim | 3.13-slim | Debian slim variant |
<python>-alpine | 3.13-alpine | Alpine variant |
<python> | 3.13 | Alias for <python>-slim |
<python>-<distro>-<version> | 3.13-slim-v1.2.0 | Immutable release tag |
All tags are published for linux/amd64 and linux/arm64.
See the Tags tab for the full list of currently available images.
github-token?A minimal Docker image that generates short-lived GitHub App installation tokens. Replace inline bash JWT generation in your Kubernetes jobs and CI pipelines with a single container invocation.
Zero external Python dependencies. The image contains only CPython and the application source code.
$GITHUB_OUTPUT.The private key can be provided in two ways:
GITHUB_APP_PRIVATE_KEY) -- pass the PEM
string directly. No volume mount required.GITHUB_APP_PRIVATE_KEY_PATH) -- mount the PEM file
into the container. Defaults to /etc/github/GITHUB_APP_PRIVATE_KEY.If both are set, the environment variable takes precedence.
docker run --rm \
-e GITHUB_APP_ID=12345 \
-e GITHUB_APP_INSTALLATION_ID=67890 \
-e GITHUB_APP_PRIVATE_KEY="$(cat /path/to/key.pem)" \
enponsba/github-token:latest
The token is printed to stdout.
docker run --rm \
-e GITHUB_APP_ID=12345 \
-e GITHUB_APP_INSTALLATION_ID=67890 \
-v /path/to/key.pem:/etc/github/GITHUB_APP_PRIVATE_KEY:ro \
enponsba/github-token:latest
Request only the permissions you need:
docker run --rm \
-e GITHUB_APP_ID=12345 \
-e GITHUB_APP_INSTALLATION_ID=67890 \
-e GITHUB_APP_PRIVATE_KEY="$(cat /path/to/key.pem)" \
-e GITHUB_TOKEN_PERMISSIONS='{"contents":"read","pull_requests":"write"}' \
-e GITHUB_TOKEN_REPOSITORIES='my-repo,other-repo' \
enponsba/github-token:latest
docker run --rm \
-e GITHUB_APP_ID=12345 \
-e GITHUB_APP_INSTALLATION_ID=67890 \
-e GITHUB_APP_PRIVATE_KEY="$(cat /path/to/key.pem)" \
-e GITHUB_TOKEN_OUTPUT=file:/shared/token \
-v /tmp/shared:/shared \
enponsba/github-token:latest
Use as an init container to provide a token to your main workload. The private key can be injected directly from a Secret as an environment variable -- no volume mount for the key is needed:
initContainers:
- name: get-token
image: enponsba/github-token:latest
env:
- name: GITHUB_APP_ID
valueFrom:
secretKeyRef:
name: github-app-secret
key: GITHUB_APP_ID
- name: GITHUB_APP_INSTALLATION_ID
valueFrom:
secretKeyRef:
name: github-app-secret
key: GITHUB_APP_INSTALLATION_ID
- name: GITHUB_APP_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: github-app-secret
key: GITHUB_APP_PRIVATE_KEY
- name: GITHUB_TOKEN_OUTPUT
value: "file:/shared/token"
volumeMounts:
- name: shared
mountPath: /shared
Complete examples: Kubernetes Job | ArgoCD PostSync hook
| Variable | Required | Description |
|---|---|---|
GITHUB_APP_ID | Yes | GitHub App ID |
GITHUB_APP_INSTALLATION_ID | Yes | Installation ID for the target org/repo |
GITHUB_APP_PRIVATE_KEY | No | PEM-encoded private key as a string |
GITHUB_APP_PRIVATE_KEY_PATH | No | Path to PEM file (default: /etc/github/GITHUB_APP_PRIVATE_KEY) |
GITHUB_TOKEN_PERMISSIONS | No | JSON object of token permissions (e.g. {"contents":"read"}) |
GITHUB_TOKEN_REPOSITORIES | No | Comma-separated list of repository names to scope the token to |
GITHUB_TOKEN_OUTPUT | No | Output mode (see below) |
Either GITHUB_APP_PRIVATE_KEY or GITHUB_APP_PRIVATE_KEY_PATH must be
provided. If both are set, the literal key string takes precedence.
| Value | Behavior |
|---|---|
stdout (default) | Prints the token to stdout |
file:/path/to/file | Writes the token to the specified file |
github-output | Appends token=<value> to $GITHUB_OUTPUT for use in GitHub Actions |
slim (default)Based on Debian python:<version>-slim. Recommended for most use cases.
alpineBased on python:<version>-alpine. Smaller image at the cost of musl libc
instead of glibc. Use when image size is the primary concern.
All images are multi-platform manifests supporting:
linux/amd64linux/arm64nobody user (non-root).For security concerns, see the security policy.
Content type
Image
Digest
sha256:d88829116…
Size
41.9 MB
Last updated
7 months ago
docker pull enponsba/github-token