From a789196f539e56035b6c62b577cdfc7bd5f60eff Mon Sep 17 00:00:00 2001 From: thursday Date: Wed, 17 Nov 2021 18:30:57 -0500 Subject: Adding updated Docker image build workflow (#83) --- .github/workflows/build-and-publish.yml | 63 +++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 18 ---------- 2 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/build-and-publish.yml delete mode 100644 .github/workflows/main.yml (limited to '.github') diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..bd24f9c --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,63 @@ +name: Build and Publish Docker Image + +on: + push: + tags: + - 'v*.*.*' + release: + types: [published] + workflow_dispatch: + +jobs: + image-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + getferdi/ferdi-server +# ghcr.io/getferdi/ferdi-server + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + - 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 + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }}, getferdi/ferdi-server:latest + labels: ${{ steps.meta.outputs.labels }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index e21943b..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Trigger Docker Hub build - -on: - release: - types: [published] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - name: Install HTTPie - run: sudo apt-get install httpie - - - name: Send request to Docker Hub to trigger a build - run: > - http post https://hub.docker.com/api/build/v1/source/83564f19-c21a-4dae-9690-971aee3b2a3b/trigger/${{ env.HUB_TRIGGER_ID }}/call/' -- cgit v1.2.3-54-g00ecf