Docker builds in Forgejo Actions

Container builds need a runner model, registry credentials, cache expectations, and a rollback story.

Actions

What this solves

You want to build and publish Docker images from Forgejo workflows.

Best fit

  • Service images
  • Release pipelines
  • Private registries
  • Migration from GitHub Actions

How to think about it

Docker builds stress more of the runner than ordinary test jobs: disk space, privileges, registry access, cache behavior, and secret handling. Decide whether the runner builds locally or delegates to a remote builder before production depends on it.

Image build outline

steps:
  - uses: actions/checkout@v4
  - run: docker build -t registry.example.com/app:${{ github.sha }} .
  - run: echo "$REGISTRY_PASSWORD" | docker login registry.example.com -u "$REGISTRY_USER" --password-stdin
  - run: docker push registry.example.com/app:${{ github.sha }}

Practical path

  1. 01 Decide whether builds run privileged, rootless, or through a remote builder.
  2. 02 Store registry credentials as Forgejo secrets.
  3. 03 Test cache behavior and failure logs before cutting over production deploys.

When to choose another path

Keep registry credentials in Forgejo secrets.

Watch runner disk pressure and image cleanup.

Use immutable image tags for deploy and rollback.

Next resources

Related reading