2021-05-14 14:32:32 +03:00
|
|
|
#
|
|
|
|
# Glances Dockerfile (based on Debian)
|
|
|
|
#
|
|
|
|
# https://github.com/nicolargo/glances
|
|
|
|
#
|
|
|
|
|
2021-05-14 15:41:12 +03:00
|
|
|
FROM python:3.9-slim-buster as build
|
2021-05-14 14:32:32 +03:00
|
|
|
|
|
|
|
# Install package
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
python3-dev \
|
|
|
|
curl \
|
|
|
|
gcc \
|
|
|
|
lm-sensors \
|
|
|
|
wireless-tools \
|
|
|
|
iputils-ping && \
|
|
|
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2021-05-14 14:42:53 +03:00
|
|
|
|
|
|
|
FROM build as remoteInstall
|
2021-05-14 14:32:32 +03:00
|
|
|
# Force rebuild otherwise it could be cached without rerun
|
2021-05-15 10:43:26 +03:00
|
|
|
ARG CHANGING_ARG
|
2021-05-14 14:32:32 +03:00
|
|
|
RUN pip3 install --no-cache-dir --user glances[all]
|
|
|
|
|
2021-05-14 14:42:53 +03:00
|
|
|
|
2021-05-14 14:32:32 +03:00
|
|
|
FROM build as additional-packages
|
|
|
|
|
|
|
|
COPY *requirements.txt .
|
|
|
|
|
|
|
|
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt
|
|
|
|
|
|
|
|
|
2021-05-14 14:42:53 +03:00
|
|
|
FROM build as dev
|
|
|
|
|
|
|
|
COPY . /glances
|
|
|
|
COPY --from=additional-packages /root/.local/lib/python3.9/site-packages /usr/lib/python3.9/site-packages/
|
|
|
|
|
|
|
|
# EXPOSE PORT (XMLRPC / WebUI)
|
|
|
|
EXPOSE 61209 61208
|
|
|
|
|
|
|
|
# Define default command.
|
|
|
|
CMD python3 -m glances -C /glances/conf/glances.conf $GLANCES_OPT
|
|
|
|
|
|
|
|
|
|
|
|
#Create running images without any building dependency
|
2021-05-14 15:41:12 +03:00
|
|
|
FROM python:3.9-slim-buster as minimal
|
2021-05-14 14:32:32 +03:00
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
curl \
|
|
|
|
lm-sensors \
|
|
|
|
wireless-tools \
|
|
|
|
iputils-ping && \
|
|
|
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2021-05-14 14:42:53 +03:00
|
|
|
COPY --from=remoteInstall /root/.local/bin /usr/local/bin/
|
|
|
|
COPY --from=remoteInstall /root/.local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages/
|
2021-05-14 14:32:32 +03:00
|
|
|
|
|
|
|
# EXPOSE PORT (XMLRPC / WebUI)
|
|
|
|
EXPOSE 61209 61208
|
|
|
|
|
|
|
|
# Define default command.
|
|
|
|
CMD python3 -m glances -C /glances/conf/glances.conf $GLANCES_OPT
|
|
|
|
|
|
|
|
|
|
|
|
FROM minimal as full
|
|
|
|
|
|
|
|
COPY --from=additional-packages /root/.local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages/
|