From f3951be46540c6d4a462ab423a8d4021666eb78c Mon Sep 17 00:00:00 2001 From: Michele Bologna Date: Thu, 28 Nov 2024 15:47:39 +0100 Subject: [PATCH 1/2] Feat: enable arm64 builds --- .github/workflows/docker-image.yml | 59 ++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 07ba2b7..599bbad 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,18 +1,61 @@ -name: Docker Image CI +name: Build and Push Docker Image on: push: - branches: [ "master" ] + branches: + - master pull_request: - branches: [ "master" ] + branches: + - master jobs: - build: - runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag dweomer/stunnel:$(date +%s) + - name: Checkout code + uses: actions/checkout@v4 + + # Set up Docker Buildx for multi-architecture builds + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # Cache Docker layers for faster builds + - name: Cache Docker Layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-latest + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log into registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + tags: | + ${{ secrets.DOCKER_USERNAME }}/docker-bitlbee:latest + ghcr.io/${{ github.repository_owner }}/docker-bitlbee:latest + cache-from: type=gha + cache-to: type=gha,mode=max + push: ${{ github.event_name != 'pull_request' }} From af0e740c89ac76c977fc89f6d715c30e8974fdd3 Mon Sep 17 00:00:00 2001 From: Michele Bologna Date: Thu, 28 Nov 2024 17:27:04 +0100 Subject: [PATCH 2/2] Fix: typo --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 599bbad..e7737cb 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -54,8 +54,8 @@ jobs: file: ./Dockerfile platforms: linux/amd64,linux/arm64 tags: | - ${{ secrets.DOCKER_USERNAME }}/docker-bitlbee:latest - ghcr.io/${{ github.repository_owner }}/docker-bitlbee:latest + ${{ secrets.DOCKER_USERNAME }}/stunnel:latest + ghcr.io/${{ github.repository_owner }}/stunnel:latest cache-from: type=gha cache-to: type=gha,mode=max push: ${{ github.event_name != 'pull_request' }}