Browse Source

Docker images for ARM32v7 and ARM64v8 (#5031)

Build and publish ARM32v7 and ARM64v8 docker images.

Signed-off-by: Johannes Würbach <johannes.wuerbach@googlemail.com>
pull/5768/head
Johannes Würbach 6 years ago committed by Ben Kochie
parent
commit
8dfd829fef
  1. 24
      .circleci/config.yml
  2. 2
      .dockerignore
  3. 10
      Dockerfile
  4. 3
      Makefile
  5. 39
      Makefile.common

24
.circleci/config.yml

@ -53,11 +53,11 @@ jobs:
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/prometheus prometheus
- run: ln -s .build/linux-amd64/promtool promtool
- run: make docker
- run: make docker DOCKER_REPO=quay.io/prometheus
- run: docker images
@ -65,13 +65,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:
executor: 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}
@ -84,19 +88,23 @@ jobs:
- store_artifacts:
path: .tarballs
destination: releases
- run: ln -s .build/linux-amd64/prometheus prometheus
- run: ln -s .build/linux-amd64/promtool promtool
- 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
makefile_sync:
executor: golang

2
.dockerignore

@ -3,3 +3,5 @@ data/
.tarballs/
!.build/linux-amd64/
!.build/linux-armv7/
!.build/linux-arm64/

10
Dockerfile

@ -1,8 +1,12 @@
FROM quay.io/prometheus/busybox:latest
ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
COPY prometheus /bin/prometheus
COPY promtool /bin/promtool
ARG ARCH="amd64"
ARG OS="linux"
COPY .build/${OS}-${ARCH}/prometheus /bin/prometheus
COPY .build/${OS}-${ARCH}/promtool /bin/promtool
COPY documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml
COPY console_libraries/ /usr/share/prometheus/console_libraries/
COPY consoles/ /usr/share/prometheus/consoles/

3
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
STATICCHECK_IGNORE = \

39
Makefile.common

@ -88,6 +88,12 @@ BIN_DIR ?= $(shell pwd)
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
DOCKER_REPO ?= prom
DOCKER_ARCHS ?= amd64
BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
ifeq ($(GOHOSTARCH),amd64)
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
# Only supported on amd64
@ -197,17 +203,28 @@ common-tarball: promu
@echo ">> building release tarball"
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
.PHONY: common-docker
common-docker:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
.PHONY: common-docker-publish
common-docker-publish:
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
.PHONY: common-docker-tag-latest
common-docker-tag-latest:
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest"
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
--build-arg ARCH="$*" \
--build-arg OS="linux" \
.
.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
.PHONY: common-docker-manifest
common-docker-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(DOCKER_IMAGE_TAG))
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
.PHONY: promu
promu: $(PROMU)

Loading…
Cancel
Save