Skip to content

Commit

Permalink
Fix issue in tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Bcoderx6 authored Jan 6, 2025
1 parent 408f261 commit a97fe02
Showing 1 changed file with 27 additions and 36 deletions.
63 changes: 27 additions & 36 deletions .github/workflows/docker-hub-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
branches:
- master
- develop
- multiArchitectureFeature
tags:
- 'v*.*.*'

Expand All @@ -16,7 +15,7 @@ concurrency:

env:
DOCKER_REGISTRY: index.docker.io
DOCKER_USERNAME: mryash
DOCKER_USERNAME: metacall
IMAGE_NAME: core
BUILDKIT_VERSION: 0.13.0

Expand All @@ -29,16 +28,13 @@ jobs:
matrix:
platform:
- linux/amd64
# - linux/arm64
# - linux/riscv64
# - linux/ppc64le
# - linux/s390x
- linux/386
# - linux/arm/v7
# - linux/arm/v6
# - linux/mips64le
# - linux/mips64

- linux/arm64
- linux/riscv64
- linux/ppc64le
- linux/s390x
- linux/arm/v7
- linux/arm/v6
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -65,33 +61,15 @@ jobs:
run: |
./docker-compose.sh platform
- name: List Docker Images
run: docker images

- name: Tag Platform Images
run: |
platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-')
echo "Platform Tag: ${platform_tag}"
for tag in "deps" "dev" "runtime" "cli"; do
docker tag ${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} \
docker tag metacall/${IMAGE_NAME}:${tag} \
${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}
done
- name: Create Test Dockerfile
run: |
cat <<EOF > Dockerfile
FROM ${DOCKER_USERNAME}/${IMAGE_NAME}:cli
RUN echo "console.log('abcde')" > script.js
RUN metacallcli script.js
EOF
- name: Build and Test Image
run: |
set -exuo pipefail
platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-')
docker build --platform ${{ matrix.platform }} -t test-image .
docker run --rm --platform=${{ matrix.platform }} test-image | grep "abcde"
- name: Push Platform Images
run: |
platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-')
Expand All @@ -100,6 +78,19 @@ jobs:
docker push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}
done
- name: Run Tests
run: |
set -exuo pipefail
platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-')
cat <<EOF > Dockerfile.test
FROM ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag}
RUN echo "console.log('abcde')" > script.js
RUN metacallcli script.js
EOF
docker build --platform ${{ matrix.platform }} -f Dockerfile.test -t test-image .
docker run --rm --platform=${{ matrix.platform }} test-image
manifest:
name: Create and Push Manifest Lists
needs: build
Expand All @@ -116,10 +107,11 @@ jobs:
for tag in "deps" "dev" "runtime" "cli"; do
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_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}"
for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do
platform_tag=$(echo "${platform}" | tr '/' '-')
platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}"
done
echo "Creating manifest with tags: ${platform_tags}"
docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend
docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}
done
Expand All @@ -129,7 +121,7 @@ jobs:
run: |
VERSION=${GITHUB_REF#refs/tags/v}
tags=("deps" "dev" "runtime" "cli")
platforms=("linux-amd64" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-386" "linux-arm-v7" "linux-arm-v6")
platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6")
for tag in "${tags[@]}"; do
platform_tags=""
for platform in "${platforms[@]}"; do
Expand All @@ -139,7 +131,6 @@ jobs:
docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag}
done
# 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}"
Expand All @@ -155,7 +146,7 @@ jobs:
steps:
- name: Remove Platform-Specific Tags
run: |
platforms=("linux-amd64" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-386" "linux-arm-v7" "linux-arm-v6")
platforms=("linux-amd64" "linux-386" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-arm-v7" "linux-arm-v6")
tags=("deps" "dev" "runtime" "cli")
for platform in "${platforms[@]}"; do
Expand Down

0 comments on commit a97fe02

Please sign in to comment.