Skip to content

Commit

Permalink
ci: build docker images for several architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Wojtczak committed Dec 26, 2022
1 parent 0f16c54 commit 09c0f2a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 26 deletions.
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ jobs:
steps:
- checkout
- setup_remote_docker
- 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: make install-github-release
- run: echo 'export PATH=${HOME}/bin:${PATH}' >> ${BASH_ENV}
- attach_workspace:
at: .
Expand All @@ -79,12 +78,14 @@ jobs:
- run: make install-docker
- run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
- run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- run: make docker-publish DOCKER_IMAGE_TAG=$CIRCLE_TAG
- run: make docker-manifest DOCKER_IMAGE_TAG=$CIRCLE_TAG
- 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
make docker-publish DOCKER_IMAGE_TAG="latest"
make docker-manifest DOCKER_IMAGE_TAG="latest"
fi
- run: make docker-publish
- run: make docker-manifest
workflows:
version: 2
Expand Down
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
.tarballs/

!.build/linux-amd64/
!.build/linux-armv7/
!.build/linux-arm64/
!.build/linux-ppc64le/
!.build/linux-s390x/
29 changes: 15 additions & 14 deletions .promu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,25 @@ tarball:
- NOTICE
crossbuild:
platforms:
- linux/amd64
- linux/386
# - darwin/386
- darwin/amd64
# - darwin/386
- windows/amd64
- windows/386
- dragonfly/amd64
- freebsd/amd64
- freebsd/386
# - openbsd/amd64
# - openbsd/386
- netbsd/amd64
- netbsd/386
- dragonfly/amd64
- freebsd/arm
- linux/386
- linux/amd64
- linux/arm
- linux/arm64
# - freebsd/arm
- netbsd/arm
# - linux/ppc64
# - linux/ppc64le
- linux/mips64
- linux/mips64le
# - linux/ppc64
- linux/ppc64le
- linux/s390x
- netbsd/amd64
- netbsd/386
- netbsd/arm
- openbsd/amd64
- openbsd/386
- windows/amd64
- windows/386
21 changes: 16 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
FROM quay.io/prometheus/busybox:latest
LABEL maintainer="Maxime Wojtczak <maxime.wojtczak@zenika.com>"
ARG ARCH="amd64"
ARG OS="linux"

RUN mkdir -p /etc/snmp_notifier
COPY snmp_notifier /bin/snmp_notifier
COPY description-template.tpl /etc/snmp_notifier/description-template.tpl
FROM debian AS builder

ARG ARCH="amd64"
ARG OS="linux"

RUN mkdir -p /rootdir/etc/snmp_notifier
COPY .build/${OS}-${ARCH}/snmp_notifier /rootdir/bin/snmp_notifier
COPY description-template.tpl /rootdir/etc/snmp_notifier/description-template.tpl
COPY LICENSE NOTICE /rootdir/

FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="Maxime Wojtczak <maxime.pub@icloud.com>"

COPY --from=builder rootdir /

EXPOSE 9464
ENTRYPOINT [ "/bin/snmp_notifier" ]
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ install-docker:

listen:
snmptrapd -m ALL -m +SNMP-NOTIFIER-MIB -M +$(mkfile_dir)/mibs/ -f -Of -Lo -c scripts/snmptrapd.conf

install-github-release:
apt-get update
apt-get install --yes bzip2
mkdir -v -p ${HOME}/bin
curl -L 'https://github.com/github-release/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2' | tar xvjf - --strip-components 3 -C ${HOME}/bin

2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ DOCKERFILE_PATH ?= ./Dockerfile
DOCKERBUILD_CONTEXT ?= ./
DOCKER_REPO ?= prom

DOCKER_ARCHS ?= amd64
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le s390x

BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SNMP Notifier for Prometheus Alert Manager
Copyright 2018 Maxime Wojtczak
Copyright 2022 Maxime Wojtczak

0 comments on commit 09c0f2a

Please sign in to comment.