github-docker-action
GitHub Docker Container Action
Build, package, and test custom GitHub Actions using Docker containers.
Not what you need? For running sidecar services (Redis, PostgreSQL, etc.) in CI workflows, see the
github-service-containersskill.
Prerequisites
- Repository on GitHub (public, internal, or private)
- Basic understanding of GitHub Actions and Docker
- Self-hosted runners must run Linux with Docker installed
Security: Always treat workflow inputs as untrusted. Avoid script injection via
${{ }}inrun:blocks.
Workflow: Creating a Docker Action
Step 1: Create project structure
my-action/
├── Dockerfile
├── action.yml
├── entrypoint.sh
└── README.md
Step 2: Write Dockerfile
Minimal:
FROM alpine:3.21
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Step 3: Define action metadata
Declare inputs, outputs, and Docker configuration in action.yml.
Step 4: Write entrypoint script
Script receives inputs as positional args. Write outputs to $GITHUB_OUTPUT.
Step 5: Make entrypoint executable
git add entrypoint.sh
git update-index --chmod=+x entrypoint.sh
Verify: git ls-files --stage entrypoint.sh should show 100755.
Step 6: Tag and push
git add action.yml entrypoint.sh Dockerfile README.md
git commit -m "Initial action release"
git tag -a -m "v1 release" v1
git push --follow-tags
Step 7: Test in a workflow
Quick Reference
| Component | Purpose |
|---|---|
Dockerfile |
Container image definition |
action.yml |
Action metadata (inputs, outputs, runner) |
entrypoint.sh |
Code executed when container starts |
README.md |
Usage docs for action consumers |
Key environment variables
| Variable | Description |
|---|---|
$GITHUB_OUTPUT |
File to write output key=value pairs |
$GITHUB_WORKSPACE |
Repo checkout dir (maps to /github/workspace in container) |
$GITHUB_ENV |
File to set env vars for later steps |
Container filesystem mapping
The runner maps GITHUB_WORKSPACE to /github/workspace in the container.
Files written there are available to subsequent workflow steps.
Reading Order
| Task | Files to Read |
|---|---|
| Scaffold new action | SKILL.md (this file) |
| Dockerfile questions | dockerfile-patterns.md |
| Configure inputs/outputs | action-metadata.md |
| Write entrypoint logic | entrypoint-scripts.md |
| Test in workflow | workflow-testing.md |
| Debug container issues | dockerfile-patterns.md + entrypoint-scripts.md |
In This Reference
| File | Purpose |
|---|---|
| dockerfile-patterns.md | Dockerfile templates and gotchas |
| action-metadata.md | action.yml spec and examples |
| entrypoint-scripts.md | Entrypoint, outputs, permissions |
| workflow-testing.md | Workflow YAML for public/private |
More from kjanat/skills
github-script
Writes secure actions/github-script workflow steps. Use when GitHub Actions needs inline JavaScript with GitHub API/context.
8changelog-writing
Write and maintain changelogs following the Keep a Changelog convention. Use when creating a CHANGELOG.md, adding entries for a release, or reviewing changelog format and completeness.
7index-knowledge
Generate hierarchical AGENTS.md knowledge base for a codebase. Creates root + complexity-scored subdirectory documentation.
6uv-versioning
Version bumping workflow for uv projects. Use when reading/updating package versions, planning release bump chains, or validating main vs workspace package bumps.
6github-service-containers
Configure Docker service containers (Redis, PostgreSQL, etc.) as sidecar services in GitHub Actions workflows for integration testing. Use when adding databases, caches, or message queues to CI workflows, or debugging service container networking and health checks.
6build-skill
Create effective skills for OpenCode agents. Load FIRST before writing any SKILL.md. Provides required format, naming conventions, progressive disclosure patterns, and validation. Use when building, reviewing, or debugging skills.
5