Skip to content

Commit

Permalink
Revert "Building Arm Images (cortexproject#5041)"
Browse files Browse the repository at this point in the history
This reverts commit f5b08ea.
  • Loading branch information
soonping-amzn committed Feb 23, 2023
1 parent 10c9f30 commit 67741fd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 42 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/scripts/install-docker.sh
Expand Up @@ -4,8 +4,4 @@ set -x
VER="20.10.19"
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mkdir -vp ~/.docker/cli-plugins/
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
mv /tmp/docker/* /usr/bin
docker run --privileged --rm tonistiigi/binfmt --install all
2 changes: 1 addition & 1 deletion .github/workflows/test-build-deploy.yml
Expand Up @@ -147,7 +147,7 @@ jobs:
run: |
export CORTEX_IMAGE_PREFIX="${IMAGE_PREFIX:-quay.io/cortexproject/}"
export IMAGE_TAG=$(make image-tag)
export CORTEX_IMAGE="${CORTEX_IMAGE_PREFIX}cortex:$IMAGE_TAG-amd64"
export CORTEX_IMAGE="${CORTEX_IMAGE_PREFIX}cortex:$IMAGE_TAG"
export CORTEX_CHECKOUT_DIR="/go/src/github.com/cortexproject/cortex"
echo "Running integration tests with image: $CORTEX_IMAGE"
go test -tags=integration,${{ matrix.tags }} -timeout 2400s -v -count=1 ./integration/...
Expand Down
26 changes: 7 additions & 19 deletions Makefile
Expand Up @@ -9,9 +9,6 @@
VERSION=$(shell cat "./VERSION" 2> /dev/null)
GOPROXY_VALUE=$(shell go env GOPROXY)

# ARCHS
ARCHS = amd64 arm64

# Boiler plate for building Docker containers.
# All this must go at top of file I'm afraid.
IMAGE_PREFIX ?= quay.io/cortexproject/
Expand Down Expand Up @@ -40,9 +37,8 @@ SED ?= $(shell which gsed 2>/dev/null || which sed)
# Dependencies (i.e. things that go in the image) still need to be explicitly
# declared.
%/$(UPTODATE): %/Dockerfile
for arch in $(ARCHS); do \
$(SUDO) docker buildx build --platform linux/$$arch --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) -t $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG)-$$arch $(@D)/ ; \
done
@echo
$(SUDO) docker build --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) -t $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG) $(@D)/
@echo
@echo Please use push-multiarch-build-image to build and push build image for all supported architectures.
touch $@
Expand Down Expand Up @@ -164,11 +160,7 @@ else
exes: $(EXES)

$(EXES):
@for arch in $(ARCHS); do \
echo "Building $@ for $$arch";\
CGO_ENABLED=0 GOARCH=$$arch GOOS=linux go build $(GO_FLAGS) -o $@-$$arch ./$(@D); \
done

CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)

protos: $(PROTO_GOS)

Expand Down Expand Up @@ -280,20 +272,16 @@ clean-protos:

save-images:
@mkdir -p docker-images
@for image_name in $(IMAGE_NAMES); do \
for image_name in $(IMAGE_NAMES); do \
if ! echo $$image_name | grep build; then \
for arch in $(ARCHS); do \
docker save $$image_name:$(IMAGE_TAG)-$$arch -o docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG)-$$arch; \
done;\
docker save $$image_name:$(IMAGE_TAG) -o docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG); \
fi \
done

load-images:
@for image_name in $(IMAGE_NAMES); do \
for image_name in $(IMAGE_NAMES); do \
if ! echo $$image_name | grep build; then \
for arch in $(ARCHS); do \
docker load -i docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG)-$$arch; \
done;\
docker load -i docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG); \
fi \
done

Expand Down
23 changes: 5 additions & 18 deletions push-images
Expand Up @@ -29,32 +29,19 @@ done

push_image() {
local image="$1"

for arch in amd64 arm64; do \
echo "Pushing ${image}-linux:${IMAGE_TAG}-$arch"
docker tag ${image}:${IMAGE_TAG}-$arch ${image}-linux:${IMAGE_TAG}-$arch
docker push ${image}-linux:${IMAGE_TAG}-$arch
done;

docker manifest create ${image}:${IMAGE_TAG} --amend ${image}-linux:${IMAGE_TAG}-amd64 --amend ${image}-linux:${IMAGE_TAG}-arm64
docker manifest push ${image}:${IMAGE_TAG}

echo "Pushing ${image}:${IMAGE_TAG}"
docker push ${image}:${IMAGE_TAG}

if [ -n "${NO_QUAY}" ]; then
return
fi

# remove the quay prefix and push to docker hub
docker_hub_image=${image#$QUAY_PREFIX}
for arch in amd64 arm64; do \
docker tag ${image}:${IMAGE_TAG}-$arch ${docker_hub_image}-linux:${IMAGE_TAG}-$arch

echo "Pushing ${docker_hub_image}-linux:${IMAGE_TAG}-$arch"
docker push ${docker_hub_image}-linux:${IMAGE_TAG}-$arch
done;
docker tag ${image}:${IMAGE_TAG} ${docker_hub_image}:${IMAGE_TAG}

docker manifest create ${docker_hub_image}:${IMAGE_TAG} --amend ${docker_hub_image}-linux:${IMAGE_TAG}-amd64 --amend ${docker_hub_image}-linux:${IMAGE_TAG}-arm64
docker manifest push ${docker_hub_image}:${IMAGE_TAG}
echo "Pushing ${docker_hub_image}:${IMAGE_TAG}"
docker push ${docker_hub_image}:${IMAGE_TAG}
}

for image in ${IMAGES}; do
Expand Down

0 comments on commit 67741fd

Please sign in to comment.