Skip to content

Commit

Permalink
Backport fix for all docker images showing amd64 architecture.
Browse files Browse the repository at this point in the history
Signed-off-by: James Blair <mail@jamesblair.net>
  • Loading branch information
jmhbnz committed Apr 10, 2023
1 parent abdc3cc commit a9a9c8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ cp "${BINARYDIR}"/etcd "${BINARYDIR}"/etcdctl "${IMAGEDIR}"
cat ./"${DOCKERFILE}" > "${IMAGEDIR}"/Dockerfile

if [ -z "$TAG" ]; then
docker build -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}"
docker build -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}"
# Fix incorrect image "Architecture" using buildkit
# From https://stackoverflow.com/q/72144329/
DOCKER_BUILDKIT=1 docker build -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}"
DOCKER_BUILDKIT=1 docker build -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}"
else
docker build -t "${TAG}:${VERSION}" "${IMAGEDIR}"
fi
10 changes: 10 additions & 0 deletions scripts/test_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,13 @@ if [ "${GET}" != "${VALUE}" ]; then
fi

echo "Succesfully tested etcd local image ${TAG}"

for TARGET_ARCH in "amd64" "arm64" "ppc64le" "s390x"; do
ARCH_TAG=v"${VERSION}"-"${TARGET_ARCH}"
IMG_ARCH=$(docker inspect --format '{{.Architecture}}' "${REPOSITARY}:${ARCH_TAG}")
if [ "${IMG_ARCH}" != "$TARGET_ARCH" ];then
echo "Incorrect docker image architecture"
exit 1
fi
echo "Correct Architecture ${ARCH_TAG}"
done

0 comments on commit a9a9c8f

Please sign in to comment.