Skip to content
server

GitHub Action

docker-build-action

v5 Latest version

docker-build-action

server

docker-build-action

Simplified Docker image builds with Github Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: docker-build-action

uses: serversideup/github-action-docker-build@v5

Learn more about this action in serversideup/github-action-docker-build

Choose a version

Header Image

License Support us
Discourse users Discord

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.

Find us at:

  • πŸ“– 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

Our Sponsors

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.

Individual Supporters

deligoezΒ Β alexjustesenΒ Β 

About this project

This is a GitHub Action intended to simplify the process for building automated Docker images with GitHub Actions.

Features:

  • βœ… Stupid simple to use
  • πŸš€ Customize your docker image names/tags by easily passing what you want it to be
  • πŸ€“ Multi-arch support
  • πŸ”€ Context aware (great if you have a Docker file in a different part of your repo)

Usage

Here is an example workflow:

name: Docker Publish (Production Images)
on:
  push:

jobs:
  docker-publish:
    runs-on: ubuntu-22.04
    steps:
      - name: docker-build-action
        uses: serversideup/github-action-docker-build@v3
        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"

Configuration options

πŸ”€ Input Name πŸ“š Description πŸ›‘ Required πŸ‘‰ Default
tags Enter the tag you would like to name your image with. (example: myorg/myapp:production) ⚠️ Yes
registry-username Enter the username to authenticate with your registry. ⚠️ Yes
registry-token Enter the token or password to authenticate with your registry. (an access token is highly recommended) ⚠️ Yes
registry Choose which container image repository to upload to. See all options. Docker Hub
context The relative path to the Dockerfile. .
dockerfile Filename of the Dockerfile within the context that you set. {context}/Dockerfile
platforms Comma separated list of platforms. linux/amd64
target The target build stage to build. ''

Important security notice

Always use encrypted secrets when passing sensitive information. Learn more here β†’

Security Disclosures

If you find a security vulnerability, please let us know as soon as possible.

View Our Responsible Disclosure Policy β†’