debian.Dockerfile 1.8 KB
Newer Older
1 2 3 4 5 6
#
# Glances Dockerfile (based on Debian)
#
# https://github.com/nicolargo/glances
#

7
FROM python:3.9-slim-buster as build
8 9 10 11 12 13 14 15 16 17 18 19

# 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/*

20 21

FROM build as remoteInstall
22 23 24 25 26
# 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
27
ARG CHANGING_ARG
28 29
RUN pip3 install --no-cache-dir --user glances[all]

30

31 32 33 34 35 36 37
FROM build as additional-packages

COPY *requirements.txt .

RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt


38 39 40
FROM build as dev

COPY --from=additional-packages /root/.local/lib/python3.9/site-packages /usr/lib/python3.9/site-packages/
41
COPY . /glances
42 43 44 45

# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208

46 47
WORKDIR /glances

48 49 50 51 52
# Define default command.
CMD python3 -m glances -C /glances/conf/glances.conf $GLANCES_OPT


#Create running images without any building dependency
53
FROM python:3.9-slim-buster as minimal
54 55 56 57 58 59 60 61 62

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/*

63 64
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/
65 66 67 68 69 70 71 72 73 74 75

# 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/