Forked from
ICS Control System Infrastructure / csentry
223 commits behind the upstream repository.
-
Benjamin Bertrand authored
Allow to send metrics to a zabbix server JIRA INFRA-614 #action In Progress
Benjamin Bertrand authoredAllow to send metrics to a zabbix server JIRA INFRA-614 #action In Progress
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Dockerfile 2.02 KiB
FROM python:3.6-slim as base
# Install Python dependencies in an intermediate image
# as some requires a compiler (uwsgi)
FROM base as builder
# Install dependencies required to compile some Python packages
# Taken from https://github.com/docker-library/python/blob/master/3.6/stretch/slim/Dockerfile
# For psycopg2: libpq-dev
# For pillow: libjpeg-dev libpng-dev libtiff-dev
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
gcc \
libbz2-dev \
libc6-dev \
libexpat1-dev \
libffi-dev \
libjpeg-dev \
libgdbm-dev \
liblzma-dev \
libncursesw5-dev \
libpcre3-dev \
libpng-dev \
libpq-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtiff-dev \
make \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Compile uwsgi with graylog2 plugin
RUN wget https://projects.unbit.it/downloads/uwsgi-2.0.17.1.tar.gz \
&& tar xfz uwsgi-2.0.17.1.tar.gz \
&& cd uwsgi-2.0.17.1 \
&& UWSGI_EMBED_PLUGINS=graylog2,zabbix python uwsgiconfig.py --build
COPY requirements.txt /requirements.txt
RUN python -m venv /venv \
&& . /venv/bin/activate \
&& pip install --no-cache-dir -r /requirements.txt
ARG CSENTRY_BUILD
COPY requirements-dev.txt /requirements-dev.txt
RUN if [ "$CSENTRY_BUILD" = "DEV" ] ; then /venv/bin/pip install --no-cache-dir -r /requirements-dev.txt ; fi
FROM base
RUN groupadd -r -g 1000 csi \
&& useradd --no-log-init -r -g csi -u 1000 csi
COPY --chown=csi:csi --from=builder /venv /venv
COPY --chown=csi:csi --from=builder /uwsgi-2.0.17.1/uwsgi /venv/bin/uwsgi
# Install libraries for psycopg2, pillow and uwsgi
# Shall be the same as the one linked to when compiling in builder image!
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
libjpeg62-turbo \
libpng16-16 \
libtiff5 \
libpq5 \
libpcre3 \
zlib1g \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --chown=csi:csi . /app/
WORKDIR /app
ENV PATH /venv/bin:$PATH
USER csi