152 lines
5.4 KiB
YAML
152 lines
5.4 KiB
YAML
name: Build Docker Image
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
schedule:
|
|
- cron: '@monthly'
|
|
jobs:
|
|
# build-amd64:
|
|
# runs-on: linux_amd
|
|
# name: Build AMD64
|
|
# container:
|
|
# image: catthehacker/ubuntu:act-latest
|
|
# env:
|
|
# DOCKER_ORG: technocloud-public
|
|
# RUNNER_TOOL_CACHE: /toolcache
|
|
# strategy:
|
|
# matrix:
|
|
# python-version: ['3.10']
|
|
# outputs:
|
|
# digest-3-10: ${{ steps.digest.outputs.DIGEST_3_10 }}
|
|
# digest-3-11: ${{ steps.digest.outputs.DIGEST_3_11 }}
|
|
# digest-3-12: ${{ steps.digest.outputs.DIGEST_3_12 }}
|
|
# digest-3-13: ${{ steps.digest.outputs.DIGEST_3_13 }}
|
|
# steps:
|
|
# - name: Checkout
|
|
# uses: actions/checkout@v4
|
|
# with:
|
|
# github-server-url: https://gitea.technocloud.ee
|
|
# - name: Set up Docker BuildX
|
|
# uses: docker/setup-buildx-action@v3
|
|
# with:
|
|
# platforms: linux/amd64
|
|
# - name: Login to DockerHub
|
|
# uses: docker/login-action@v3
|
|
# with:
|
|
# registry: gitea.technocloud.ee
|
|
# username: ${{ secrets.DOCKER_USERNAME }}
|
|
# password: ${{ secrets.DOCKER_PASSWORD }}
|
|
# - name: Get Meta
|
|
# id: meta
|
|
# run: |
|
|
# echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
|
# - name: Build and Push AMD64
|
|
# id: build-docker
|
|
# uses: docker/build-push-action@v5
|
|
# with:
|
|
# context: .
|
|
# file: Dockerfile.python${{ matrix.python-version }}
|
|
# platforms: linux/amd64
|
|
# push: true
|
|
# provenance: false
|
|
# outputs: type=image,name=gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }},push-by-digest=true
|
|
# - name: Summarize the Docker digest
|
|
# id: digest
|
|
# run: |
|
|
# PY_VERSION=${{ matrix.python-version }}
|
|
# PY_VERSION_MOD=$(echo $PY_VERSION | sed 's/\./_/g')
|
|
# echo DIGEST_${PY_VERSION_MOD}="${{ steps.build-docker.outputs.digest }}"
|
|
# echo DIGEST_${PY_VERSION_MOD}="${{ steps.build-docker.outputs.digest }}" >> $GITHUB_OUTPUT
|
|
|
|
build-arm64:
|
|
runs-on: ubuntu-latest
|
|
name: Build ARM64
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
env:
|
|
DOCKER_ORG: technocloud-public
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.10']
|
|
outputs:
|
|
digest-3-10: ${{ steps.digest.outputs.DIGEST_3_10 }}
|
|
digest-3-11: ${{ steps.digest.outputs.DIGEST_3_11 }}
|
|
digest-3-12: ${{ steps.digest.outputs.DIGEST_3_12 }}
|
|
digest-3-13: ${{ steps.digest.outputs.DIGEST_3_13 }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
github-server-url: https://gitea.technocloud.ee
|
|
- name: Set up Docker BuildX
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
platforms: linux/arm64
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.technocloud.ee
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Get Meta
|
|
id: meta
|
|
run: |
|
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
|
- name: Build and Push ARM64
|
|
id: build-docker
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile.python${{ matrix.python-version }}
|
|
platforms: linux/arm64
|
|
push: true
|
|
provenance: false
|
|
outputs: type=image,name=gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }},push-by-digest=true
|
|
- name: Summarize the Docker digest
|
|
id: digest
|
|
run: |
|
|
PY_VERSION=${{ matrix.python-version }}
|
|
PY_VERSION_MOD=$(echo $PY_VERSION | sed 's/\./_/g')
|
|
echo DIGEST_${PY_VERSION_MOD}="${{ steps.build-docker.outputs.digest }}"
|
|
echo DIGEST_${PY_VERSION_MOD}="${{ steps.build-docker.outputs.digest }}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
create-manifest:
|
|
needs: [build-arm64]
|
|
runs-on: ubuntu-latest
|
|
name: Create Multi-arch Manifest
|
|
env:
|
|
DOCKER_ORG: technocloud-public
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.10']
|
|
steps:
|
|
- name: Login to Docker Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.technocloud.ee
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Set up Docker BuildX
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver: docker-container
|
|
|
|
- name: Get Repository Metadata
|
|
id: meta
|
|
run: |
|
|
echo "REPO_NAME=${GITHUB_REPOSITORY}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create and Push Multi-arch Manifest
|
|
env:
|
|
ARM_DIGEST: ${{ needs.build-arm64.outputs[format('digest-{0}', matrix.python-version | replace('.', '-'))] }}
|
|
run: |
|
|
echo "Digest 4UUUU: ${{ needs.build-arm64.outputs[format('digest-{0}', matrix.python-version | replace('.', '-'))] }}"
|
|
echo "Digest 3UUUU: $ARM_DIGEST ppp ${ARM_DIGEST}"
|
|
echo '${{ toJSON(needs.build-arm64.outputs) }}'
|
|
IMAGE_NAME=gitea.technocloud.ee/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:python${{ matrix.python-version }}
|
|
docker manifest create $IMAGE_NAME --amend gitea.technocloud.ee/technocloud-public/nginx-unit@${ARM_DIGEST}
|
|
docker manifest push $IMAGE_NAME |