Add a Github Actions job to publish Docker images to Dockerhub and ghcr (#2027)

* Add a Github Actions job to publish Docker images to Dockerhub and ghcr
* Closes #1982
This commit is contained in:
Kevin Chung
2021-11-22 19:27:26 -05:00
committed by GitHub
parent cf743a2778
commit a9aa0cab61

59
.github/workflows/docker-build.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Docker build image on release
# on:
# release:
# types: [published]
on:
push:
branches:
- 'master'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
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_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# -
# name: Build and push
# uses: docker/build-push-action@v2
# with:
# context: .
# platforms: linux/amd64
# push: true
# tags: |
# ctfd/ctfd:latest
# ghcr.io/ctfd/ctfd:latest
# ctfd/ctfd:${{ github.event.release.tag_name }}
# ghcr.io/ctfd/ctfd:${{ github.event.release.tag_name }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
tags: |
ctfd/ctfd:test-github-action
ghcr.io/ctfd/ctfd:test-github-action