forked from SUSE/prometheus-webhook-snmp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
49 lines (41 loc) · 1.79 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM quay.io/centos/centos:stream8
# Update repos to use the vault mirror, now that CentOS 8 Stream is EOL
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# >> ignore SC2086 because passing quoted env vars to dnf causes issues (fail to install)
# hadolint ignore=SC2086
RUN INSTALL_PKGS="\
procps-ng \
telnet \
lsof \
python3 \
python3-devel \
gcc \
" && \
dnf -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False install $INSTALL_PKGS && \
dnf -y clean all
COPY . /source/app
WORKDIR /source/app
RUN alternatives --set python /usr/bin/python3 && \
python -m pip install --no-cache-dir -r requirements-build.txt && \
python -m pip install --no-cache-dir . && \
python -m pip freeze
# Cleanup
# >> ignore SC2086 because passing quoted env vars to dnf causes issues (fail to install)
# hadolint ignore=SC2086
RUN UNINSTALL_PKGS="\
gcc \
" && \
dnf remove -y $UNINSTALL_PKGS && \
dnf -y clean all
ENV SNMP_COMMUNITY="public"
ENV SNMP_PORT=162
ENV SNMP_HOST="localhost"
ENV SNMP_RETRIES=5
ENV SNMP_TIMEOUT=1
ENV ALERT_OID_LABEL="oid"
ENV TRAP_OID_PREFIX="1.3.6.1.4.1.50495.15"
ENV TRAP_DEFAULT_OID="1.3.6.1.4.1.50495.15.1.2.1"
ENV TRAP_DEFAULT_SEVERITY=""
EXPOSE 9099
CMD ["sh", "-c", "/usr/local/bin/prometheus-webhook-snmp --debug --snmp-port=\"${SNMP_PORT}\" --snmp-host=\"${SNMP_HOST}\" --snmp-community=\"${SNMP_COMMUNITY}\" --snmp-retries=\"${SNMP_RETRIES}\" --snmp-timeout=\"${SNMP_TIMEOUT}\" --alert-oid-label=\"${ALERT_OID_LABEL}\" --trap-oid-prefix=\"${TRAP_OID_PREFIX}\" --trap-default-oid=\"${TRAP_DEFAULT_OID}\" --trap-default-severity=\"${TRAP_DEFAULT_SEVERITY}\" run"]