diff --git a/.github/workflows/scripts/install-docker.sh b/.github/workflows/scripts/install-docker.sh index ea694615dbc..fa33f70bd51 100755 --- a/.github/workflows/scripts/install-docker.sh +++ b/.github/workflows/scripts/install-docker.sh @@ -4,4 +4,7 @@ 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 diff --git a/.github/workflows/test-build-deploy.yml b/.github/workflows/test-build-deploy.yml index 8dd03841afc..2fb7946022e 100644 --- a/.github/workflows/test-build-deploy.yml +++ b/.github/workflows/test-build-deploy.yml @@ -207,8 +207,8 @@ jobs: GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" deploy: - needs: [build, test, lint, integration, integration-configs-db] - if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' + needs: [build] + if: github.repository == 'cortexproject/cortex' runs-on: ubuntu-20.04 container: image: quay.io/cortexproject/build-image:upgrade-to-go1.19.3-e8b98ddc0 diff --git a/Makefile b/Makefile index c1ef3cf693f..faa12a3f442 100644 --- a/Makefile +++ b/Makefile @@ -37,8 +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 - @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)/ + $(SUDO) docker buildx build --platform linux/amd64 --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)/ + $(SUDO) docker buildx build --platform linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) -t $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG)-arm64 $(@D)/ @echo @echo Please use push-multiarch-build-image to build and push build image for all supported architectures. touch $@ @@ -275,6 +275,7 @@ save-images: for image_name in $(IMAGE_NAMES); do \ if ! echo $$image_name | grep build; then \ docker save $$image_name:$(IMAGE_TAG) -o docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG); \ + docker save $$image_name:$(IMAGE_TAG)-arm64 -o docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG)-arm64; \ fi \ done @@ -282,6 +283,7 @@ load-images: for image_name in $(IMAGE_NAMES); do \ if ! echo $$image_name | grep build; then \ docker load -i docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG); \ + docker load -i docker-images/$$(echo $$image_name | tr "/" _):$(IMAGE_TAG)-arm64; \ fi \ done diff --git a/cmd/cortex/Dockerfile b/cmd/cortex/Dockerfile index ab995a5332c..7a61865d27f 100644 --- a/cmd/cortex/Dockerfile +++ b/cmd/cortex/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14 +FROM --platform=$BUILDPLATFORM alpine:3.14 RUN apk add --no-cache ca-certificates COPY migrations /migrations/ COPY cortex /bin/cortex diff --git a/cmd/query-tee/Dockerfile b/cmd/query-tee/Dockerfile index 622ed403ea6..46218b7ac8c 100644 --- a/cmd/query-tee/Dockerfile +++ b/cmd/query-tee/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14 +FROM --platform=$BUILDPLATFORM alpine:3.14 RUN apk add --no-cache ca-certificates COPY query-tee / ENTRYPOINT ["/query-tee"] diff --git a/cmd/test-exporter/Dockerfile b/cmd/test-exporter/Dockerfile index 927d6d9a272..004953e302a 100644 --- a/cmd/test-exporter/Dockerfile +++ b/cmd/test-exporter/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14 +FROM --platform=$BUILDPLATFORM alpine:3.14 RUN apk add --no-cache ca-certificates COPY test-exporter / ENTRYPOINT ["/test-exporter"] diff --git a/cmd/thanosconvert/Dockerfile b/cmd/thanosconvert/Dockerfile index 2a97a9c765b..065ac8fc923 100644 --- a/cmd/thanosconvert/Dockerfile +++ b/cmd/thanosconvert/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14 +FROM --platform=$BUILDPLATFORM alpine:3.14 RUN apk add --no-cache ca-certificates COPY thanosconvert / ENTRYPOINT ["/thanosconvert"] diff --git a/push-images b/push-images index c6cae70c62c..c21edae1516 100755 --- a/push-images +++ b/push-images @@ -38,10 +38,12 @@ push_image() { # remove the quay prefix and push to docker hub docker_hub_image=${image#$QUAY_PREFIX} - docker tag ${image}:${IMAGE_TAG} ${docker_hub_image}:${IMAGE_TAG} + for arch in amd64 arm64; do \ + docker tag ${image}:${IMAGE_TAG} ${docker_hub_image}:${IMAGE_TAG}-$arch - echo "Pushing ${docker_hub_image}:${IMAGE_TAG}" - docker push ${docker_hub_image}:${IMAGE_TAG} + echo "Pushing ${docker_hub_image}:${IMAGE_TAG}-$arch" + docker push ${docker_hub_image}:${IMAGE_TAG}-$arch + done; } for image in ${IMAGES}; do