From 0d986a4bbc001b4a5c6b2300fbe3af37a3a3b165 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 19 Jun 2023 18:14:34 +0300 Subject: [PATCH] Adding the Github actions workflows --- .github/workflows/build-push-docker-image.yml | 58 +++++++++++++++++++ .github/workflows/tag-release.yml | 8 +++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/build-push-docker-image.yml diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml new file mode 100644 index 000000000..ffe651457 --- /dev/null +++ b/.github/workflows/build-push-docker-image.yml @@ -0,0 +1,58 @@ +name: build-push-docker-image + +#on: workflow_dispatch +on: + push: + branches: feature/docker_configs + workflow_dispatch: + +jobs: + build-push-docker-image: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get the latest release + id: release + uses: robinraju/release-downloader@v1.7 + with: + latest: true + fileName: "*.tar.bz2" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push the Production image + uses: docker/build-push-action@v4 + with: + context: . + file: docker/Dockerfile.prod + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/openconext/stepup-selfservice/stepup-selfservice:prod + ghcr.io/openconext/stepup-selfservice/stepup-selfservice:${{ github.sha }} + ghcr.io/openconext/stepup-selfservice/stepup-selfservice:${{ steps.release.outputs.tag_name }} + + - name: Build and push the Development image + uses: docker/build-push-action@v4 + with: + context: . + file: docker/Dockerfile.dev + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/openconext/stepup-selfservice/stepup-selfservice:dev diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index eacff250a..8e69af5e1 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -62,3 +62,11 @@ jobs: with: release_id: ${{ steps.create_release.outputs.id }} + after_build: + needs: build + runs-on: ubuntu-latest + steps: + - name: Trigger Docker container build + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: build-push-docker-image.yml