mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 20:36:21 +01:00
Docker images for ARM32v7, ARM64v8 and ppc64le (#1207)
Build and publish ARM32v7, ARM64v8 and ppc64le docker images. Signed-off-by: Johannes Würbach <johannes.wuerbach@googlemail.com>
This commit is contained in:
parent
e71e9f5a2f
commit
4e5c4d464f
@ -31,7 +31,8 @@ jobs:
|
|||||||
- run: codespell --skip=".git,./vendor,ttar,go.mod,go.sum" -L uint
|
- run: codespell --skip=".git,./vendor,ttar,go.mod,go.sum" -L uint
|
||||||
|
|
||||||
build:
|
build:
|
||||||
machine: true
|
machine:
|
||||||
|
image: ubuntu-1604:201903-01
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.11-base
|
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.11-base
|
||||||
@ -39,6 +40,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- run: docker run --privileged linuxkit/binfmt:v0.6
|
||||||
- run: make promu
|
- run: make promu
|
||||||
- run: promu crossbuild
|
- run: promu crossbuild
|
||||||
- run: promu --config .promu-cgo.yml crossbuild
|
- run: promu --config .promu-cgo.yml crossbuild
|
||||||
@ -49,7 +51,6 @@ jobs:
|
|||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: .build
|
path: .build
|
||||||
destination: /build
|
destination: /build
|
||||||
- run: ln -s .build/linux-amd64/node_exporter node_exporter
|
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
if [ -n "$CIRCLE_TAG" ]; then
|
if [ -n "$CIRCLE_TAG" ]; then
|
||||||
@ -72,10 +73,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- setup_remote_docker
|
- setup_remote_docker:
|
||||||
|
version: 18.06.0-ce
|
||||||
|
- run: docker run --privileged linuxkit/binfmt:v0.6
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
- run: ln -s .build/linux-amd64/node_exporter node_exporter
|
|
||||||
- run: make docker
|
- run: make docker
|
||||||
- run: make docker DOCKER_REPO=quay.io/prometheus
|
- run: make docker DOCKER_REPO=quay.io/prometheus
|
||||||
- run: docker images
|
- run: docker images
|
||||||
@ -83,13 +85,17 @@ jobs:
|
|||||||
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
||||||
- run: make docker-publish
|
- run: make docker-publish
|
||||||
- run: make docker-publish DOCKER_REPO=quay.io/prometheus
|
- 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_hub_release_tags:
|
||||||
executor: golang
|
executor: golang
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- 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: 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: 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}
|
- run: echo 'export PATH=${HOME}/bin:${PATH}' >> ${BASH_ENV}
|
||||||
@ -102,18 +108,23 @@ jobs:
|
|||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: .tarballs
|
path: .tarballs
|
||||||
destination: releases
|
destination: releases
|
||||||
- run: ln -s .build/linux-amd64/node_exporter node_exporter
|
|
||||||
- run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
- run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
- run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG DOCKER_REPO=quay.io/prometheus
|
- 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 $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
||||||
- run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
|
- 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: |
|
- run: |
|
||||||
if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
|
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"
|
||||||
make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus
|
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
|
fi
|
||||||
- run: make docker-publish
|
|
||||||
- run: make docker-publish DOCKER_REPO=quay.io/prometheus
|
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
@ -2,3 +2,6 @@
|
|||||||
.tarballs/
|
.tarballs/
|
||||||
|
|
||||||
!.build/linux-amd64
|
!.build/linux-amd64
|
||||||
|
!.build/linux-armv7
|
||||||
|
!.build/linux-arm64
|
||||||
|
!.build/linux-ppc64le
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
FROM quay.io/prometheus/busybox:glibc
|
ARG ARCH="amd64"
|
||||||
|
ARG OS="linux"
|
||||||
|
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:glibc
|
||||||
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
|
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
|
||||||
|
|
||||||
COPY node_exporter /bin/node_exporter
|
ARG ARCH="amd64"
|
||||||
|
ARG OS="linux"
|
||||||
|
COPY .build/${OS}-${ARCH}/node_exporter /bin/node_exporter
|
||||||
|
|
||||||
EXPOSE 9100
|
EXPOSE 9100
|
||||||
USER nobody
|
USER nobody
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
FROM ppc64le/busybox:glibc
|
|
||||||
|
|
||||||
COPY node_exporter /bin/node_exporter
|
|
||||||
|
|
||||||
EXPOSE 9100
|
|
||||||
USER nobody
|
|
||||||
ENTRYPOINT [ "/bin/node_exporter" ]
|
|
14
Makefile
14
Makefile
@ -14,6 +14,9 @@
|
|||||||
# Ensure that 'all' is the default target otherwise it will be the first target from Makefile.common.
|
# Ensure that 'all' is the default target otherwise it will be the first target from Makefile.common.
|
||||||
all::
|
all::
|
||||||
|
|
||||||
|
# Needs to be defined before including Makefile.common to auto-generate targets
|
||||||
|
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le
|
||||||
|
|
||||||
include Makefile.common
|
include Makefile.common
|
||||||
|
|
||||||
PROMTOOL_VERSION ?= 2.5.0
|
PROMTOOL_VERSION ?= 2.5.0
|
||||||
@ -22,7 +25,6 @@ PROMTOOL ?= $(FIRST_GOPATH)/bin/promtool
|
|||||||
|
|
||||||
DOCKER_IMAGE_NAME ?= node-exporter
|
DOCKER_IMAGE_NAME ?= node-exporter
|
||||||
MACH ?= $(shell uname -m)
|
MACH ?= $(shell uname -m)
|
||||||
DOCKERFILE ?= Dockerfile
|
|
||||||
|
|
||||||
STATICCHECK_IGNORE =
|
STATICCHECK_IGNORE =
|
||||||
|
|
||||||
@ -114,18 +116,10 @@ checkrules: $(PROMTOOL)
|
|||||||
@echo ">> checking rules for correctness"
|
@echo ">> checking rules for correctness"
|
||||||
find . -name "*rules*.yml" | xargs -I {} $(PROMTOOL) check rules {}
|
find . -name "*rules*.yml" | xargs -I {} $(PROMTOOL) check rules {}
|
||||||
|
|
||||||
.PHONY: docker
|
|
||||||
docker:
|
|
||||||
ifeq ($(MACH), ppc64le)
|
|
||||||
$(eval DOCKERFILE=Dockerfile.ppc64le)
|
|
||||||
endif
|
|
||||||
@echo ">> building docker image from $(DOCKERFILE)"
|
|
||||||
@docker build --file $(DOCKERFILE) -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
|
|
||||||
|
|
||||||
.PHONY: test-docker
|
.PHONY: test-docker
|
||||||
test-docker:
|
test-docker:
|
||||||
@echo ">> testing docker image"
|
@echo ">> testing docker image"
|
||||||
./test_image.sh "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" 9100
|
./test_image.sh "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-amd64:$(DOCKER_IMAGE_TAG)" 9100
|
||||||
|
|
||||||
.PHONY: promtool
|
.PHONY: promtool
|
||||||
promtool: $(PROMTOOL)
|
promtool: $(PROMTOOL)
|
||||||
|
@ -88,6 +88,12 @@ BIN_DIR ?= $(shell pwd)
|
|||||||
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
|
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
|
||||||
DOCKER_REPO ?= prom
|
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 ($(GOHOSTARCH),amd64)
|
||||||
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
|
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
|
||||||
# Only supported on amd64
|
# Only supported on amd64
|
||||||
@ -197,17 +203,28 @@ common-tarball: promu
|
|||||||
@echo ">> building release tarball"
|
@echo ">> building release tarball"
|
||||||
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
||||||
|
|
||||||
.PHONY: common-docker
|
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
|
||||||
common-docker:
|
common-docker: $(BUILD_DOCKER_ARCHS)
|
||||||
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
|
$(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
|
.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
|
||||||
common-docker-publish:
|
common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
|
||||||
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
|
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
|
||||||
|
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
|
||||||
|
|
||||||
.PHONY: common-docker-tag-latest
|
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
|
||||||
common-docker-tag-latest:
|
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
|
||||||
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest"
|
$(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
|
.PHONY: promu
|
||||||
promu: $(PROMU)
|
promu: $(PROMU)
|
||||||
|
Loading…
Reference in New Issue
Block a user