No description
  • Shell 80.4%
  • Dockerfile 19.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nick Adcock dd27d0cda0
Merge pull request #3 from docker/token
Change the example Docker Hub repository being pushed to to be owned by scsautobuildsorg namespace.
Change the secret name from PASSWORD to TOKEN to be more explicit about what it holds.
Pin GHA actions by SHA.
2026-06-03 12:40:30 +01:00
.github Pin docker/login-action by SHA 2026-06-03 12:30:33 +01:00
hooks Add examples and readme for autobuilds as actions 2025-10-23 11:01:08 +01:00
docker-compose.test.yml Add examples and readme for autobuilds as actions 2025-10-23 11:01:08 +01:00
Dockerfile Add examples and readme for autobuilds as actions 2025-10-23 11:01:08 +01:00
LICENSE Add LICENSE file 2026-04-29 10:28:29 +01:00
README.md Change repo to scsautobuildsorg owned and explicitly use TOKEN 2026-06-03 12:23:43 +01:00
run_tests.sh Add examples and readme for autobuilds as actions 2025-10-23 11:01:08 +01:00

Docker Hub Autobuilds Actions

This repository demonstrates how to configure GitHub Actions workflows to replicate Docker Hub Automated Builds (Autobuilds) functionality, helping users migrate from Docker Hub to GitHub Actions for automated container image building.

Overview

Autobuilds provided automatic image builds triggered by repository changes. This project shows how to achieve the same functionality using GitHub Actions, making it easier to migrate your build workflows.

Features

  • Automated Docker image builds on push.
  • Tag management and versioning.
  • Push to Docker Hub registry.
  • Optionally run pre and post hook files during workflow.
  • Optionally run docker-compose test files before pushing the image.

Getting Started

See the .github/workflows directory for example workflow configurations that replicate common Autobuilds patterns.

Migration Guide

Review your existing Autobuilds configuration

Navigate to the Docker Hub repository on hub.docker.com you wish to migrate from Autobuilds to GitHub Actions and go to it's "Builds" tab.

On the Builds tab, select "Build Configuration" to display the existing Autobuilds configuration for this repository.

You will need to take note of:

  1. The "Source Repository": This will be the GitHub repository where you will need to configure the GitHub Action workflow.
  2. Autotest: If enabled you will want to use the full-autobuilds.yaml workflow example from this repository in order to run docker compose to test your code before pushing the image to Docker Hub.
  3. Build Rules: This will specify the "Source" branch or tag, target "Docker Tag", "Dockerfile location", and "Build Context" path that will need to be configured in the GitHub Action workflows.

Configure repository secrets for registry credentials

In order to push an image to Docker Hub you will first need credentials to login.

  • If the target Docker Hub repository is under a User then create a Personal Access Token with "Read & Write" permissions.
  • If the target Docker Hub repository is under an Organization then create an Organization Access Token with "Read public repositories", "Image Pull", and "Image Push" permissions.

Store the login details under the GitHub repository as repository secrets:

  • DOCKER_USERNAME: this should be set to the username/org-name of the User or Organization the Docker Hub repository sits under.
  • DOCKER_TOKEN: this is the token you created.

Configure the GitHub Action workflow

Two example workflows are included in this repository:

Copy the workflow you want into your GitHub repository under the .github/workflows directory at the root of repository.

For both workflows you must configure the branch/tag triggers under on, the env environment variables, and adjust the meta step's tagging rules to match your existing Autobuilds build configuration.

Note that the hooks/ directory, Dockerfile, docker-compose.test.yml, and run_tests.sh files do not need to be copied to your GitHub repository. They are here for demonstration purposes only.

Resources