multiarch!
This commit is contained in:
82
.gitea/workflows/buildpublish.yaml
Normal file
82
.gitea/workflows/buildpublish.yaml
Normal file
@@ -0,0 +1,82 @@
|
||||
name: Build-Publish-Multi-Arch
|
||||
run-name: Build and publish multi-architecture Docker images
|
||||
|
||||
on: [push]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.jde.nz
|
||||
username: DoesntMatter
|
||||
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||
|
||||
- name: Build Images
|
||||
run: |
|
||||
./build.sh
|
||||
|
||||
- name: Publish as Architecture-Specific
|
||||
run: |
|
||||
# Only publish on main branch
|
||||
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
||||
DOCKER_PUSH_TOKEN=${{ secrets.DOCKER_PUSH_TOKEN }} \
|
||||
./publish.sh
|
||||
fi
|
||||
|
||||
create-manifest:
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.jde.nz
|
||||
username: DoesntMatter
|
||||
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y jq
|
||||
|
||||
- name: Create and push manifest lists
|
||||
run: |
|
||||
# Only create manifest on main branch
|
||||
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
||||
# Get list of all Dockerfile.* files to determine image names
|
||||
for dockerfile in Dockerfile.*; do
|
||||
image_name="${dockerfile//Dockerfile./}"
|
||||
|
||||
echo "Creating manifest for ${image_name}..."
|
||||
|
||||
# Create the manifest list using the architecture-specific digests
|
||||
docker manifest create gitea.jde.nz/public/${image_name}:latest \
|
||||
--amend gitea.jde.nz/public/${image_name}:latest-x86_64 \
|
||||
--amend gitea.jde.nz/public/${image_name}:latest-aarch64
|
||||
|
||||
# Push the manifest list
|
||||
docker manifest push gitea.jde.nz/public/${image_name}:latest
|
||||
|
||||
echo "Manifest list for ${image_name} created and pushed successfully"
|
||||
done
|
||||
|
||||
echo "All manifest lists created and pushed successfully"
|
||||
fi
|
Reference in New Issue
Block a user