From 9f5447bf4651c9e2e4af44c75307eb504d4dc059 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 16 Apr 2019 14:41:18 +0200 Subject: [PATCH] Build container images for ARM32v7 and ARM64v8 Signed-off-by: Simon Pasquier --- .circleci/config.yml | 24 ++++++++++++++++-------- Dockerfile | 12 ++++++++---- Makefile | 3 +++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ba2bde21..fb1f7935 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,11 +85,11 @@ jobs: - image: circleci/golang steps: - checkout - - setup_remote_docker + - setup_remote_docker: + version: 18.06.0-ce + - run: docker run --privileged linuxkit/binfmt:v0.6 - attach_workspace: at: . - - run: ln -s .build/linux-amd64/alertmanager alertmanager - - run: ln -s .build/linux-amd64/amtool amtool - run: make docker - run: make docker DOCKER_REPO=quay.io/prometheus - run: docker images @@ -97,13 +97,17 @@ jobs: - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io - run: make docker-publish - run: make docker-publish DOCKER_REPO=quay.io/prometheus + - run: make docker-manifest + - run: make docker-manifest DOCKER_REPO=quay.io/prometheus docker_hub_release_tags: docker: - image: circleci/golang steps: - checkout - - setup_remote_docker + - setup_remote_docker: + version: 18.06.0-ce + - run: docker run --privileged linuxkit/binfmt:v0.6 - run: mkdir -v -p ${HOME}/bin - run: curl -L 'https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2' | tar xvjf - --strip-components 3 -C ${HOME}/bin - run: echo 'export PATH=${HOME}/bin:${PATH}' >> ${BASH_ENV} @@ -116,19 +120,23 @@ jobs: - store_artifacts: path: .tarballs destination: releases - - run: ln -s .build/linux-amd64/alertmanager alertmanager - - run: ln -s .build/linux-amd64/amtool amtool - run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG - run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG DOCKER_REPO=quay.io/prometheus - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io + - run: make docker-publish DOCKER_IMAGE_TAG="$CIRCLE_TAG" + - run: make docker-publish DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus + - run: make docker-manifest DOCKER_IMAGE_TAG="$CIRCLE_TAG" + - run: make docker-manifest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus - run: | if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus + make docker-publish DOCKER_IMAGE_TAG="latest" + make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=quay.io/prometheus + make docker-manifest DOCKER_IMAGE_TAG="latest" + make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=quay.io/prometheus fi - - run: make docker-publish - - run: make docker-publish DOCKER_REPO=quay.io/prometheus workflows: version: 2 diff --git a/Dockerfile b/Dockerfile index ab6303a2..7d98d53c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ -FROM prom/busybox:latest +ARG ARCH="amd64" +ARG OS="linux" +FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest LABEL maintainer="The Prometheus Authors " -COPY amtool /bin/amtool -COPY alertmanager /bin/alertmanager -COPY examples/ha/alertmanager.yml /etc/alertmanager/alertmanager.yml +ARG ARCH="amd64" +ARG OS="linux" +COPY .build/${OS}-${ARCH}/amtool /bin/amtool +COPY .build/${OS}-${ARCH}/alertmanager /bin/alertmanager +COPY examples/ha/alertmanager.yml /etc/alertmanager/alertmanager.yml RUN mkdir -p /alertmanager && \ chown -R nobody:nogroup etc/alertmanager /alertmanager diff --git a/Makefile b/Makefile index 54ce0b7a..7bec8a01 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Needs to be defined before including Makefile.common to auto-generate targets +DOCKER_ARCHS ?= amd64 armv7 arm64 + include Makefile.common FRONTEND_DIR = $(BIN_DIR)/ui/app