Since September 2021, Docker changed its business model, and No longer allows to auto-build Dockerfiles for free.
You can easily use to Github Action as a Continuous Deployment strategy for Docker images.
This script will also build both
arm64
(works natively with Apple silicon macs) and amd64
images!First, head to the "Action" tab on your Github project
And create the following workflow:
name: Docker Image CI on: release: types: [published] jobs: docker: runs-on: ubuntu-latest steps: - name: Get the version id: vars run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) - name: Checkout uses: actions/checkout@v2 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build and push uses: docker/build-push-action@v2 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: ${{ github.repository }}:latest,${{ github.repository }}:${{steps.vars.outputs.tag}}
On your settings, set the secrets for
DOCKERHUB_USERNAME
and DOCKERHUB_PASSWORD
You will need to create a Docker hub token that will be used as a password:
And now, as soon as you tag a new release on Github, it will auto-build the image, tag it and publish it :)
This article is brought you by tonoïd – we are a micro-startup studio building small businesses that are profitable and solve a specific problem without any external funding nor billion-dollar market-size. Most notably, RefurbMe, a comparison site for refurbished products – and Notion Automations.
If you have any feedback, do not hesitate to reach out at Contact