Skip to content

Commit

Permalink
fix arch
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancole committed Dec 17, 2020
1 parent ff8b5a4 commit eb64ed9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
1 change: 1 addition & 0 deletions build-bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ if [ "${version}" != "master" ]; then
fi

export DOCKER_FILE=Dockerfile
export DOCKER_ARCHS=amd64
build-bin/docker/docker_build openzipkin/java:test ${version}
1 change: 1 addition & 0 deletions build-bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fi
# Base layers are not pushed to Docker Hub (docker.io)
export DOCKER_RELEASE_REPOS=ghcr.io
export DOCKER_FILE=Dockerfile
export DOCKER_ARCHS=amd64

# Don't make latest tag
DOCKER_TAGS=${version} build-bin/docker/docker_push openzipkin/java ${version}
47 changes: 31 additions & 16 deletions build-bin/docker/docker_push
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ docker_archs=${DOCKER_ARCHS:-amd64 arm64}
echo "Will build the following architectures: ${docker_archs}"

docker_tag0="$(echo ${docker_tags} | awk '{print $1;}')"
docker_arch0="$(echo ${docker_archs} | awk '{print $1;}')"
arch_tags=""
for docker_arch in ${docker_archs}; do
arch_tag=${docker_image}:${docker_tag0}-${docker_arch}
Expand All @@ -79,24 +80,38 @@ done

echo "Will push the following tags:\n${tags}"

for tag in $(echo ${tags} | xargs); do
manifest_tags=""
for arch_tag in ${arch_tags}; do
docker_arch=$(echo ${arch_tag} | sed 's/.*-//g')
manifest_tag=${tag}-${docker_arch}
docker tag ${arch_tag} ${manifest_tag}
echo "Pushing tag ${manifest_tag}..."
docker push ${manifest_tag}
manifest_tags="${manifest_tags} ${manifest_tag}"
if [ "${docker_arch0}" = "${docker_archs}" ]; then
# single architecture
arch_tag=${docker_image}:${docker_tag0}-${docker_arch0}

for tag in $(echo ${tags} | xargs); do
docker tag ${arch_tag} ${tag}
echo "Pushing tag ${tag}..."
docker push ${tag}
done

docker manifest create ${tag} ${manifest_tags}
else
# multi-architecture: make a manifest
for tag in $(echo ${tags} | xargs); do
manifest_tags=""
for arch_tag in ${arch_tags}; do
docker_arch=$(echo ${arch_tag} | sed 's/.*-//g')
manifest_tag=${tag}-${docker_arch}
docker tag ${arch_tag} ${manifest_tag}
echo "Pushing tag ${manifest_tag}..."
docker push ${manifest_tag}
manifest_tags="${manifest_tags} ${manifest_tag}"
done

docker manifest create ${tag} ${manifest_tags}

for manifest_tag in ${manifest_tags}; do
docker_arch=$(echo ${manifest_tag} | sed 's/.*-//g')
docker manifest annotate ${tag} ${manifest_tag} --os linux --arch ${docker_arch}
for manifest_tag in ${manifest_tags}; do
docker_arch=$(echo ${manifest_tag} | sed 's/.*-//g')
docker manifest annotate ${tag} ${manifest_tag} --os linux --arch ${docker_arch}
done

echo "Pushing manifest ${manifest_tag}..."
docker manifest push -p ${tag}
done
fi

echo "Pushing manifest ${manifest_tag}..."
docker manifest push -p ${tag}
done

0 comments on commit eb64ed9

Please sign in to comment.