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 \
|
2021-05-15 12:42:49 +03:00
|
|
|
build-essential \
|
2021-05-14 14:32:32 +03:00
|
|
|
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-15 12:06:17 +03:00
|
|
|
# Install the dependencies beforehand to make them cacheable
|
|
|
|
COPY requirements.txt .
|
|
|
|
RUN pip3 install --no-cache-dir --user -r requirements.txt
|
|
|
|
|
|
|
|
# Force install 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
|
|
|
|
|
2021-05-20 17:54:36 +03:00
|
|
|
COPY *requirements.txt ./
|
2021-05-14 14:32:32 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-05-20 17:55:02 +03:00
|
|
|
COPY --from=additional-packages /root/.local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages/
|
2021-05-15 12:27:28 +03:00
|
|
|
COPY . /glances
|
2021-05-14 14:42:53 +03:00
|
|
|
|
|
|
|
# EXPOSE PORT (XMLRPC / WebUI)
|
|
|
|
EXPOSE 61209 61208
|
|
|
|
|
2021-05-15 12:27:28 +03:00
|
|
|
WORKDIR /glances
|
|
|
|
|
2021-05-14 14:42:53 +03:00
|
|
|
# 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/
|