From 7424bff375cb89fbfede89adbaedbc934b13b1ad Mon Sep 17 00:00:00 2001 From: Aaron Bolton Date: Mon, 21 Oct 2024 20:16:16 +0100 Subject: [PATCH] Create github-build-push.yml --- .github/actions/github-build-push.yml | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/actions/github-build-push.yml diff --git a/.github/actions/github-build-push.yml b/.github/actions/github-build-push.yml new file mode 100644 index 0000000..56c7074 --- /dev/null +++ b/.github/actions/github-build-push.yml @@ -0,0 +1,50 @@ +name: Build and Push Container + +on: + push: + branches: + - main + paths: + - 'Dockerfile' + workflow_dispatch: +jobs: + build-and-push: + runs-on: [self-hosted] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Containers + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ github.sha }} + + - name: Build and Push Containers + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm + push: true + tags: | + registry.bukn.net/${{ github.event.repository.name }}:latest + registry.bukn.net/${{ github.event.repository.name }}:${{ github.sha }}