diff --git a/.circleci/config.yml b/.circleci/config.yml index 49e8fab..bb8304b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: . @@ -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 diff --git a/.dockerignore b/.dockerignore index 69c6945..6e6480b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,7 @@ .tarballs/ !.build/linux-amd64/ +!.build/linux-armv7/ +!.build/linux-arm64/ +!.build/linux-ppc64le/ +!.build/linux-s390x/ diff --git a/.promu.yml b/.promu.yml index 2a97437..11b0d64 100644 --- a/.promu.yml +++ b/.promu.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index 38cda4f..437ea86 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,20 @@ -FROM quay.io/prometheus/busybox:latest -LABEL maintainer="Maxime Wojtczak " +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 " + +COPY --from=builder rootdir / EXPOSE 9464 ENTRYPOINT [ "/bin/snmp_notifier" ] diff --git a/Makefile b/Makefile index e25c0d5..72281c5 100644 --- a/Makefile +++ b/Makefile @@ -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 + \ No newline at end of file diff --git a/Makefile.common b/Makefile.common index a6f3632..f838e07 100644 --- a/Makefile.common +++ b/Makefile.common @@ -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)) diff --git a/NOTICE b/NOTICE index 214b314..6537ab4 100644 --- a/NOTICE +++ b/NOTICE @@ -1,2 +1,2 @@ SNMP Notifier for Prometheus Alert Manager -Copyright 2018 Maxime Wojtczak +Copyright 2022 Maxime Wojtczak