Refactoring: Changed all check parameters starting with a 'p' to the new rulespec...
[check_mk.git] / docker / Dockerfile
blob19f862739042e6b84d5e53731fd9c550fc1b6c22
1 FROM debian:stretch-slim
2 LABEL maintainer="feedback@check-mk.org"
4 # Pure build time variable declarations (docker build --build-arg KEY=val)
5 ARG CMK_VERSION="1.6.0i1"
6 # Choose one of: raw, enterprise, managed
7 ARG CMK_EDITION="raw"
9 ARG CMK_DL_URL="https://mathias-kettner.de/support"
10 # Give download credentials in "USER:PASSWORD" format. You can only use Raw Edition without
11 ARG CMK_DL_CREDENTIALS=""
13 # The following variables can be set during container init (docker run -e KEY=val)
14 ARG CMK_SITE_ID
15 ENV CMK_SITE_ID="cmk"
16 # Set this to "on" to enable livestatus via network
17 ARG CMK_LIVESTATUS_TCP
18 ENV CMK_LIVESTATUS_TCP=""
19 # A random password will be generated in case you don't set this
20 ARG CMK_PASSWORD
21 ENV CMK_PASSWORD=""
23 # Specify the FQDN of your relay mail server to sent mails to
24 ARG MAIL_RELAY_HOST
25 ENV MAIL_RELAY_HOST=""
27 # Make the list of required packages available to the following command
28 COPY needed-packages /needed-packages
30 # First install the tools we need for fetching the package and installation
31 # Then fetch the package and install it. This will make sure all Check_MK
32 # containers will share all dependencies, including this step.
33 # hadolint ignore=SC2046,DL3008
34 RUN set -e \
35     && echo "exit 101" > /usr/sbin/policy-rc.d \
36     && chmod +x /usr/sbin/policy-rc.d \
37     && export DEBIAN_FRONTEND=noninteractive \
38     && apt-get update \
39     && apt-get install -y --no-install-recommends \
40         ca-certificates \
41         postfix \
42         inetutils-syslogd \
43         bsd-mailx \
44         gnupg2 \
45         openssh-client \
46         iputils-ping \
47         dpkg-sig \
48         $(cat needed-packages) \
49     && apt-get clean \
50     && rm /usr/sbin/policy-rc.d \
51     && rm -rf /var/lib/apt/lists/* \
52     && rm needed-packages
55 # Optionally copy an existing Check_MK debian package to the container. In case the file is
56 # available that is later used by the build procedure the file will not be downloaded.
57 COPY check-mk-${CMK_EDITION}-${CMK_VERSION}_0.stretch_*.deb Check_MK-pubkey*gpg needed-packages /
59 # Now install the Check_MK version specific things
60 # hadolint ignore=DL3003,DL3008,DL4006
61 RUN set -e \
62     && mkdir -p /usr/share/man/man8 \
63     && echo "exit 101" > /usr/sbin/policy-rc.d \
64     && chmod +x /usr/sbin/policy-rc.d \
65     && export DEBIAN_FRONTEND=noninteractive \
66     && PKG_NAME="check-mk-${CMK_EDITION}-${CMK_VERSION}" \
67     && PKG_FILE="${PKG_NAME}_0.stretch_$(dpkg --print-architecture).deb" \
68     && if [ ! -e "/${PKG_FILE}" ]; then \
69         echo "Downloading ${PKG_FILE}..." && \
70         echo "--user \"${CMK_DL_CREDENTIALS}\"" \
71             | curl -o "${PKG_FILE}" -K - "${CMK_DL_URL}/${CMK_VERSION}/${PKG_FILE}" ; \
72        fi \
73     && if [ ! -e "/Check_MK-pubkey.gpg" ]; then \
74         echo "Downloading Check_MK-pubkey.gpg..." && \
75         curl -sS "${CMK_DL_URL}/Check_MK-pubkey.gpg" \
76             | gpg -q --import ; \
77        else \
78             gpg -q --import "/Check_MK-pubkey.gpg" ; \
79        fi \
80     && dpkg-sig --verify "${PKG_FILE}" \
81     && dpkg -i "${PKG_FILE}" \
82     && rm -f -- *.deb *.gpg needed-packages \
83     && apt-get clean \
84     && rm /usr/sbin/policy-rc.d \
85     && rm -rf /var/lib/apt/lists/*
87 LABEL \
88     org.opencontainers.image.title="Check_MK" \
89     org.opencontainers.image.version="${CMK_VERSION}" \
90     org.opencontainers.image.description="Check_MK is a leading tool for Infrastructure & Application Monitoring" \
91     org.opencontainers.image.vendor="Mathias Kettner GmbH" \
92     org.opencontainers.image.source="https://git.mathias-kettner.de/" \
93     org.opencontainers.image.url="https://mathias-kettner.com/"
95 # Ports:
96 # 5000 - Serves the Check_MK GUI
97 # 6557 - Serves Livestatus (if enabled via "omd config")
98 EXPOSE 5000 6557
100 # When all processes of the site are running everything should be fine
101 HEALTHCHECK --interval=1m --timeout=5s \
102     CMD omd status || exit 1
104 COPY docker-entrypoint.sh /
105 # Starts the entrypoint script and hands over CMD by default
106 ENTRYPOINT ["/docker-entrypoint.sh"]