Skip to content

Commit

Permalink
Update docker-hub-platform.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Bcoderx6 authored Nov 28, 2024
1 parent 21ab099 commit fc2da26
Showing 1 changed file with 34 additions and 56 deletions.
90 changes: 34 additions & 56 deletions .github/workflows/docker-hub-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:

env:
DOCKER_REGISTRY: docker.io
DOCKER_USERNAME: metacall
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
IMAGE_NAME: core
BUILDKIT_VERSION: 0.13.0

Expand All @@ -24,17 +24,8 @@ jobs:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- linux/riscv64
- linux/ppc64le
- linux/s390x
- linux/386
- linux/arm/v7
- linux/arm/v6
platform: [linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6]

steps:
- name: Checkout Repository
Expand All @@ -60,16 +51,14 @@ jobs:
env:
METACALL_PLATFORM: ${{ matrix.platform }}
run: |
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
export BUILDKIT_PROGRESS=plain
export PROGRESS_NO_TRUNC=1
./docker-compose.sh platform
- name: Push Platform Images
run: |
platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-')
echo "Platform Tag: ${platform_tag}"
for tag in "deps" "dev" "runtime" "cli"; do
echo "Pushing image for tag: ${tag} with platform: ${platform_tag}"
docker tag ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}
docker push ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}
Expand All @@ -79,6 +68,10 @@ jobs:
name: Create and Push Manifest Lists
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux-amd64, linux-arm64, linux-riscv64, linux-ppc64le, linux-s390x, linux-386, linux-arm-v7, linux-arm-v6]

steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -89,65 +82,46 @@ jobs:
- name: Create and Push Manifest Lists
run: |
for tag in "deps" "dev" "runtime" "cli"; do
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-amd64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-arm64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-riscv64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-ppc64le \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-s390x \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-386 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-arm-v7 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-arm-v6
echo "Creating manifest for tag: $tag"
platform_tags=""
platforms=("linux-amd64" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-386" "linux-arm-v7" "linux-arm-v6")
for platform in "${platforms[@]}"; do
platform_tags="${platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}"
done
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend
docker manifest push ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}
done
- name: Create Version-Specific Tags
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
for tag in "deps" "dev" "runtime" "cli"; do
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-amd64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-arm64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-riscv64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-ppc64le \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-s390x \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-386 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-arm-v7 \
${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-linux-arm-v6
tags=("deps" "dev" "runtime" "cli")
platforms=("linux-amd64" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-386" "linux-arm-v7" "linux-arm-v6")
for tag in "${tags[@]}"; do
platform_tags=""
for platform in "${platforms[@]}"; do
platform_tags="${platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}"
done
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend
docker manifest push ${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag}
done
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:latest \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-amd64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-arm64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-riscv64 \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-ppc64le \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-s390x \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-386 \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-arm-v7 \
${DOCKER_USERNAME}/${IMAGE_NAME}:cli-linux-arm-v6
# Create and push the 'latest' tag for CLI
cli_platform_tags=""
for platform in ${{ matrix.platform }}; do
cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}"
done
docker manifest create ${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend
docker manifest push ${DOCKER_USERNAME}/${IMAGE_NAME}:latest
test:
name: Test CLI Image
needs: manifest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- linux/riscv64
- linux/ppc64le
- linux/s390x
- linux/386
- linux/arm/v7
- linux/arm/v6
platform: [linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6]

steps:
- name: Login to Docker Hub
Expand Down Expand Up @@ -176,7 +150,11 @@ jobs:
needs:
- build
- manifest
- test
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux-amd64, linux-arm64, linux-riscv64, linux-ppc64le, linux-s390x, linux-386, linux-arm-v7, linux-arm-v6]
if: always()
steps:
- name: Remove Platform-Specific Tags
Expand Down

0 comments on commit fc2da26

Please sign in to comment.