docker-build-action
ActionsTags
(2)Hi! We're Dan and Jay. We're a two person team with a passion for open source products. We created Server Side Up to help share what we learn.
- 📖 Blog - get the latest guides and free courses on all things web/mobile development.
- 🙋 Community - get friendly help from our community members.
- 🤵♂️ Get Professional Help - get guaranteed responses within next business day.
- 💻 GitHub - check out our other open source projects
- 📫 Newsletter - skip the algorithms and get quality content right to your inbox
- 🐥 Twitter - you can also follow Dan and Jay
- ❤️ Sponsor Us - please consider sponsoring us so we can create more helpful resources
All of our software is free an open to the world. None of this can be brought to you without the financial backing of our sponsors.
This is a GitHub Action intended to simplify the process for building automated Docker images with GitHub Actions.
- ✅ Stupid simple to use - just pass in the tags, registry, and credentials and you're good to go
- 🚀 Customize your docker image names/tags - easily pass in what you want it to be
- 🤓 Multi-arch support - build for multiple architectures
- 📦 Multi-registry support - build and push to up to 3 registries simultaneously (Docker Hub, GitHub Container Registry, and private registries)
- 🔀 Context aware - great if you have a Dockerfile in a different part of your repo
Here is a basic example workflow for publishing to a single registry:
name: Docker Publish (Production Images)
on:
push:
jobs:
docker-publish:
runs-on: ubuntu-24.04
steps:
- name: docker-build-action
uses: serversideup/github-action-docker-build@v6
with:
tags: serversideup/financial-freedom:latest
registry-username: ${{ secrets.DOCKER_HUB_USERNAME }}
registry-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
platforms: "linux/amd64,linux/arm/v7,linux/arm64/v8"You can now push to up to 3 different registries in a single build! Perfect for publishing to Docker Hub, GitHub Container Registry, and your own private registry simultaneously:
name: Docker Publish (Multiple Registries)
on:
push:
branches:
- main
jobs:
docker-publish:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push to multiple registries
uses: serversideup/github-action-docker-build@v6
with:
# Tag with multiple registry prefixes
tags: |
docker.io/myorg/myapp:latest
ghcr.io/myorg/myapp:latest
registry.example.com/myapp:latest
# Registry 1: Docker Hub
registry: "docker.io"
registry-username: ${{ secrets.DOCKER_HUB_USERNAME }}
registry-token: ${{ secrets.DOCKER_HUB_TOKEN }}
# Registry 2: GitHub Container Registry
registry-2: "ghcr.io"
registry-username-2: ${{ github.actor }}
registry-token-2: ${{ secrets.GITHUB_TOKEN }}
# Registry 3: Custom Private Registry
registry-3: "registry.example.com"
registry-username-3: ${{ secrets.CUSTOM_REGISTRY_USER }}
registry-token-3: ${{ secrets.CUSTOM_REGISTRY_TOKEN }}
platforms: "linux/amd64,linux/arm64"💡 Pro tip: You only need to specify the registries you want to use. Registry 2 and 3 are optional and will be skipped if credentials aren't provided.
| 🔀 Input Name | 📚 Description | 🛑 Required | 👉 Default |
|---|---|---|---|
| tags | Enter the tag(s) you would like to name your image with. (example: myorg/myapp:production) Use multi-line format for multiple tags. |
||
| registry | Choose which container image repository to upload to. See all options. | docker.io |
|
| registry-username | Enter the username to authenticate with your first registry. | ||
| registry-token | Enter the token or password to authenticate with your first registry. (an access token is highly recommended) | ||
| context | The relative path to the Dockerfile. | . |
|
| dockerfile | Filename of the Dockerfile within the context that you set. | ./Dockerfile |
|
| platforms | Comma separated list of platforms. | linux/amd64 |
|
| target | The target build stage to build. |
| 🔀 Input Name | 📚 Description | 🛑 Required | 👉 Default |
|---|---|---|---|
| registry-2 | Choose which container image repository to upload to. See all options. | ||
| registry-username-2 | Enter the username to authenticate with your second registry. | ||
| registry-token-2 | Enter the token or password to authenticate with your second registry. (an access token is highly recommended) | ||
| registry-3 | Choose which container image repository to upload to. See all options. | ||
| registry-username-3 | Enter the username to authenticate with your third registry. | ||
| registry-token-3 | Enter the token or password to authenticate with your third registry. (an access token is highly recommended) |
Note
At least one registry's credentials must be provided (either registry 1, 2, or 3).
Always use encrypted secrets when passing sensitive information. Learn more here →
If you find a security vulnerability, please let us know as soon as possible.
docker-build-action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.
