docker: add multi-arch builds

This commit is contained in:
Slava 2025-01-08 16:05:08 +02:00
parent d417f55ffd
commit ba96ad3a69
No known key found for this signature in database
GPG Key ID: 351E7AA9BD0DFEB8
3 changed files with 82 additions and 76 deletions

View File

@ -1,49 +0,0 @@
name: Build Argo Workflows Runner Image
on:
push:
branches:
- master
workflow_dispatch:
env:
DOCKER_FILE: ./docker/bittorrent-benchmarks-workflows.Dockerfile
DOCKER_REPO: codexstorage/bittorrent-benchmarks-workflows
jobs:
test-and-build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REPO }}
flavor: |
latest=true
tags: |
type=sha
- name: Build and Push Prod. Image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKER_FILE }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

52
.github/workflows/argo.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Build Argo Workflows Runner Image
on:
push:
branches:
- master
tags:
- 'v*.*.*'
workflow_dispatch:
env:
DOCKER_FILE: ./docker/bittorrent-benchmarks-workflows.Dockerfile
DOCKER_REPO: codexstorage/bittorrent-benchmarks-workflows
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Test Image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKER_FILE }}
push: false
variables:
name: Compute outputs
needs: build-and-test
runs-on: ubuntu-latest
outputs:
docker_file: ${{ env.DOCKER_FILE }}
dockerhub_repo: ${{ env.DOCKER_REPO }}
steps:
- name: Dummy job
if: false
run: echo
build-and-push:
name: Build and Push
needs: variables
uses: codex-storage/github-actions/.github/workflows/docker-reusable.yml@master
with:
docker_file: ${{ needs.variables.outputs.docker_file }}
dockerhub_repo: ${{ needs.variables.outputs.dockerhub_repo }}
secrets: inherit

View File

@ -4,15 +4,19 @@ on:
push:
branches:
- master
tags:
- 'v*.*.*'
workflow_dispatch:
env:
DOCKER_FILE: ./docker/bittorrent-benchmarks.Dockerfile
DOCKER_REPO: codexstorage/bittorrent-benchmarks
BUILD_ARGS: |
BUILD_TYPE=test
jobs:
test-and-build:
build-and-test:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
@ -21,22 +25,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REPO }}
flavor: |
latest=true
tags: |
type=sha
- name: Build Test Image
uses: docker/build-push-action@v6
with:
@ -46,7 +34,7 @@ jobs:
load: true
tags: bittorrent-benchmarks:test
build-args: |
BUILD_TYPE=test
${{ env.BUILD_ARGS }}
- name: Lint
run: |
@ -64,11 +52,26 @@ jobs:
run: |
docker compose -f docker-compose.local.yaml -f docker-compose.ci.yaml up --abort-on-container-exit --exit-code-from test-runner
- name: Build and Push Prod. Image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKER_FILE }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
variables:
name: Compute outputs
needs: build-and-test
runs-on: ubuntu-latest
outputs:
docker_file: ${{ env.DOCKER_FILE }}
dockerhub_repo: ${{ env.DOCKER_REPO }}
build_args: ${{ env.BUILD_ARGS }}
steps:
- name: Dummy job
if: false
run: echo
build-and-push:
name: Build and Push
needs: variables
uses: codex-storage/github-actions/.github/workflows/docker-reusable.yml@master
with:
docker_file: ${{ needs.variables.outputs.docker_file }}
dockerhub_repo: ${{ needs.variables.outputs.dockerhub_repo }}
build_args: |
${{ needs.variables.outputs.build_args }}
secrets: inherit