From d98dc868253d9f05bc4e2b3b9b50244deb97e2c1 Mon Sep 17 00:00:00 2001 From: "Xiaoguang(William) Zhang" Date: Wed, 23 Sep 2020 16:55:13 +0000 Subject: [PATCH] Introduce prometheus-webhook-snmp for Alertmanager prometheus-webhook-snmp version: 1.4 Change-Id: I4645162d9497013eecc6c0513400d048a2792459 --- prometheus-webhook-snmp/Dockerfile | 46 ++++++++++++++++++++++++++++++ prometheus-webhook-snmp/Makefile | 21 ++++++++++++++ prometheus-webhook-snmp/VERSION | 1 + prometheus-webhook-snmp/build.sh | 11 +++++++ 4 files changed, 79 insertions(+) create mode 100644 prometheus-webhook-snmp/Dockerfile create mode 100644 prometheus-webhook-snmp/Makefile create mode 100644 prometheus-webhook-snmp/VERSION create mode 100755 prometheus-webhook-snmp/build.sh diff --git a/prometheus-webhook-snmp/Dockerfile b/prometheus-webhook-snmp/Dockerfile new file mode 100644 index 00000000..0d6fcf0b --- /dev/null +++ b/prometheus-webhook-snmp/Dockerfile @@ -0,0 +1,46 @@ +ARG FROM=docker.io/ubuntu:bionic +FROM ${FROM} + +ENV PYTHONUNBUFFERED 1 +ENV PIP_DISABLE_PIP_VERSION_CHECK=1 +ENV PIP_NO_CACHE_DIR=1 +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +LABEL maintainer="Openstack-image Authors" + +ARG BUILD_DATE=now +ARG VCS_REF +ARG VCS_URL +ARG VERSION + +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.url="https://github.com/SUSE/prometheus-webhook-snmp" \ + org.label-schema.vcs-url=$VCS_URL \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.version=$VERSION + +RUN apt-get -y update && apt-get -y upgrade && apt-get -y install --no-install-recommends \ + curl \ + wget \ + gcc \ + python3.7 \ + python3-pip \ + python3-venv \ + git + +RUN git clone -b v${VERSION} --single-branch --depth 1 https://github.com/SUSE/prometheus-webhook-snmp.git + +RUN pip3 --no-cache-dir install --upgrade setuptools && \ + pip3 --no-cache-dir install -r /prometheus-webhook-snmp/requirements.txt + + +ENV RUN_ARGS="" + +EXPOSE 9099 + +ENTRYPOINT [ "/prometheus-webhook-snmp/prometheus-webhook-snmp", "run" ] + diff --git a/prometheus-webhook-snmp/Makefile b/prometheus-webhook-snmp/Makefile new file mode 100644 index 00000000..063dd74a --- /dev/null +++ b/prometheus-webhook-snmp/Makefile @@ -0,0 +1,21 @@ +#!make + +#-include .env .env.local .env.*.local + +VCS_REF=$(shell git rev-parse --short HEAD) +BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") +VERSION:=$(shell cat VERSION) +IMAGE_NAME=prometheus-webhook-snmp + + +.PHONY: version + +build: + docker build \ + --build-arg VCS_REF=$(VCS_REF) \ + --build-arg BUILD_DATE=$(BUILD_DATE) \ + --build-arg VERSION=$(VERSION) \ + -t $(IMAGE_NAME):$(VERSION) . + +env: + env diff --git a/prometheus-webhook-snmp/VERSION b/prometheus-webhook-snmp/VERSION new file mode 100644 index 00000000..c068b244 --- /dev/null +++ b/prometheus-webhook-snmp/VERSION @@ -0,0 +1 @@ +1.4 diff --git a/prometheus-webhook-snmp/build.sh b/prometheus-webhook-snmp/build.sh new file mode 100755 index 00000000..df1228e8 --- /dev/null +++ b/prometheus-webhook-snmp/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +IMAGE="prometheus-webhook-snmp" +VERSION=${VERSION:-latest} +DISTRO=${DISTRO:-ubuntu_bionic} +REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"} +EXTRA_TAG_INFO=${EXTRA_TAG_INFO:-""} + +echo "build hook starting..." +make build +echo "build hook completed."