Test building by digest
All checks were successful
Build Docker Image / Build ARM64 (3.10) (push) Successful in 1m26s
Build Docker Image / Build AMD64 (3.10) (push) Successful in 8m39s
Build Docker Image / Create Multi-arch Manifest (3.10) (push) Successful in 15s

This commit is contained in:
2024-12-08 15:31:27 +02:00
parent d93cbda299
commit 097a8c49ab

View File

@@ -1,12 +1,10 @@
name: Build Docker Image name: Build Docker Image
on: on:
push: push:
branches: branches:
- main - main
schedule: schedule:
- cron: '@monthly' - cron: '@monthly'
jobs: jobs:
build-amd64: build-amd64:
runs-on: linux_amd runs-on: linux_amd
@@ -18,38 +16,38 @@ jobs:
RUNNER_TOOL_CACHE: /toolcache RUNNER_TOOL_CACHE: /toolcache
strategy: strategy:
matrix: matrix:
python-version: ['3.10', '3.11', '3.12', '3.13'] python-version: ['3.10']
outputs:
amd64-digest-${{ matrix.python-version }}: ${{ steps.build.outputs.digest }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
github-server-url: https://gitea.technocloud.ee github-server-url: https://gitea.technocloud.ee
- name: Set up Docker BuildX - name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
platforms: linux/amd64 platforms: linux/amd64
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: gitea.technocloud.ee registry: gitea.technocloud.ee
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Meta - name: Get Meta
id: meta id: meta
run: | run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
- name: Build and Push AMD64 - name: Build and Push AMD64
id: build
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: Dockerfile.python${{ matrix.python-version }} file: Dockerfile.python${{ matrix.python-version }}
platforms: linux/amd64 platforms: linux/amd64
push: true push: true
tags: gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }}-amd64 provenance: false
outputs: type=image,name=gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }},push-by-digest=true
build-arm64: build-arm64:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -61,38 +59,38 @@ jobs:
RUNNER_TOOL_CACHE: /toolcache RUNNER_TOOL_CACHE: /toolcache
strategy: strategy:
matrix: matrix:
python-version: ['3.10', '3.11', '3.12', '3.13'] python-version: ['3.10']
outputs:
arm64-digest-${{ matrix.python-version }}: ${{ steps.build.outputs.digest }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
github-server-url: https://gitea.technocloud.ee github-server-url: https://gitea.technocloud.ee
- name: Set up Docker BuildX - name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
platforms: linux/arm64 platforms: linux/arm64
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: gitea.technocloud.ee registry: gitea.technocloud.ee
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Meta - name: Get Meta
id: meta id: meta
run: | run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
- name: Build and Push ARM64 - name: Build and Push ARM64
id: build
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: Dockerfile.python${{ matrix.python-version }} file: Dockerfile.python${{ matrix.python-version }}
platforms: linux/arm64 platforms: linux/arm64
push: true push: true
tags: gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }}-arm64 provenance: false
outputs: type=image,name=gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }},push-by-digest=true
create-manifest: create-manifest:
needs: [build-amd64, build-arm64] needs: [build-amd64, build-arm64]
@@ -104,7 +102,7 @@ jobs:
DOCKER_ORG: technocloud-public DOCKER_ORG: technocloud-public
strategy: strategy:
matrix: matrix:
python-version: ['3.10', '3.11', '3.12', '3.13'] python-version: ['3.10']
steps: steps:
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -112,16 +110,14 @@ jobs:
registry: gitea.technocloud.ee registry: gitea.technocloud.ee
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Meta - name: Get Meta
id: meta id: meta
run: | run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
- name: Create and Push Manifest - name: Create and Push Manifest
run: | run: |
docker manifest create \ docker manifest create \
gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }} \ gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }} \
gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }}-amd64 \ gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}@${{ needs.build-amd64.outputs.amd64-digest-${{ matrix.python-version }} }} \
gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }}-arm64 gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}@${{ needs.build-arm64.outputs.arm64-digest-${{ matrix.python-version }} }}
docker manifest push gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }} docker manifest push gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }}