提交 281382c0 编写于 作者: M Markus Pöschl

Migrate the dev image also in the multi-stage build

上级 781c9961
# Dockerfiles
The Dockerfiles used here are using multi-staged builds.
For building a specific stage locally docker needs to know the target stage with `--target`.
## Examples
For the dev image:
``bash
docker build --target dev -f docker-files/debian.Dockerfile -t glances .
``
For the minimal image:
``bash
docker build --target minimal -f docker-files/debian.Dockerfile -t glances .
``
For the full image:
``bash
docker build --target full -f docker-files/debian.Dockerfile -t glances .
``
......@@ -18,10 +18,13 @@ RUN apt-get update && \
iputils-ping && \
apt-get clean && rm -rf /var/lib/apt/lists/*
FROM build as remoteInstall
# Force rebuild otherwise it could be cached without rerun
ARG VCS_REF
RUN pip3 install --no-cache-dir --user glances[all]
FROM build as additional-packages
COPY *requirements.txt .
......@@ -29,7 +32,19 @@ COPY *requirements.txt .
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt
#Create running image without any building dependency
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
FROM ${ARCH}python:3.9-slim-buster as minimal
RUN apt-get update && \
......@@ -40,8 +55,8 @@ RUN apt-get update && \
iputils-ping && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=build /root/.local/bin /usr/local/bin/
COPY --from=build /root/.local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages/
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/
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
......@@ -53,4 +68,3 @@ 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/
#
# Glances Dockerfile (based on Ubuntu)
#
# https://github.com/nicolargo/glances
#
ARG ARCH=
FROM ${ARCH}python:3-buster
# Install package
# Must used calibre package to be able to run external module
ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get update && \
apt-get install -y \
curl \
gcc \
git \
lm-sensors \
wireless-tools \
iputils-ping && \
rm -rf /var/lib/apt/lists/*
RUN pip install psutil bottle
# Define working directory
WORKDIR /glances
COPY *requirements.txt .
RUN CASS_DRIVER_NO_CYTHON=1 pip install -r optional-requirements.txt
COPY . /glances
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Define default command.
CMD python3 -m glances -C /glances/conf/glances.conf $GLANCES_OPT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册