Skip to content

wip #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

wip #30

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/scripts/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand Down Expand Up @@ -275,13 +275,15 @@ 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

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

Expand Down
2 changes: 1 addition & 1 deletion cmd/cortex/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/query-tee/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion cmd/test-exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion cmd/thanosconvert/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
8 changes: 5 additions & 3 deletions push-images
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down