summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2022-11-03 15:05:57 +0100
committernicolargo <nicolas@nicolargo.com>2022-11-03 15:07:56 +0100
commit57a8a12a68de1860fa23b7941c8dfd4a41a51cd1 (patch)
treeef25ffb6ec9d7c10c4a3f0a87712a9360814a162
parent53f74248cdaa923fb413453f4748149077fc8ea9 (diff)
Refactor Docker image factory: from now, only Alpine images will be provided
-rw-r--r--.github/workflows/build.yml4
-rw-r--r--Makefile4
-rw-r--r--README.rst17
-rw-r--r--docker-compose/Dockerfile2
-rw-r--r--docker-compose/docker-compose-with-traefik.yml2
-rw-r--r--docker-files/alpine.Dockerfile21
-rw-r--r--docker-files/debian.Dockerfile127
7 files changed, 25 insertions, 152 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a6e4b27e..c861028d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -96,7 +96,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: ['debian', 'alpine']
+ os: ['alpine']
tag: ${{ fromJson(needs.create_Docker_builds.outputs.tags) }}
steps:
- name: Checkout
@@ -139,7 +139,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: ${{ env.PUSH_BRANCH == 'true' }}
- tags: "${{ env.DEFAULT_DOCKER_IMAGE }}:${{ matrix.os != 'debian' && format('{0}-', matrix.os) || '' }}${{ matrix.tag.tag }}"
+ tags: "${{ env.DEFAULT_DOCKER_IMAGE }}:${{ matrix.os != 'alpine' && format('{0}-', matrix.os) || '' }}${{ matrix.tag.tag }}"
build-args: |
CHANGING_ARG=${{ github.sha }}
context: .
diff --git a/Makefile b/Makefile
index dc25c1b3..92fd4654 100644
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,9 @@ flatpak: venv-dev-upgrade ## Generate FlatPack JSON file
# Docker
# ===================================================================
-docker:
+docker: docker-alpine
+
+docker-alpine:
docker build --target full -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-full .
docker build --target minimal -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-minimal .
docker build --target dev -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-dev .
diff --git a/README.rst b/README.rst
index 0eeff51e..b5b5b4b9 100644
--- a/README.rst
+++ b/README.rst
@@ -181,25 +181,20 @@ If you want to support other distributions, please contribute to `glancesautoins
Docker: the fun way
-------------------
-Glances containers are availables. You can use it to monitor your
-server and all your other containers!
+Glances Docker images are availables. You can use it to monitor your
+server and all your containers !
Get the Glances container:
.. code-block:: console
- docker pull nicolargo/glances:alpine-latest-full
+ docker pull nicolargo/glances:latest-full
The following tags are availables:
-- *alpine-latest-full* for a full Alpine Glances image (latest release) with all dependencies
-- *latest-full* for a full Debian Glances image (latest release) with all dependencies
-- *alpine-latest* for a basic Alpine Glances (latest release) version with minimal dependencies
-- *latest* for a basic Debian Glances image (latest release) with minimal dependencies
-- *alpine-dev* for a basic Alpine Glances image (development branch) with all dependencies
-- *dev* for a basic Debian Glances image (development branch) with all dependencies
-
-You can also specify a version (example: *alpine-3.2.7-full*).
+- *latest-full* for a full Alpine Glances image (latest release) with all dependencies
+- *latest* for a basic Alpine Glances (latest release) version with minimal dependencies (Bottle and Docker)
+- *dev* for a basic Alpine Glances image (based on development branch) with all dependencies (Warning: may be instable)
Run last version of Glances container in *console mode*:
diff --git a/docker-compose/Dockerfile b/docker-compose/Dockerfile
index 9d2426a1..81caa69a 100644
--- a/docker-compose/Dockerfile
+++ b/docker-compose/Dockerfile
@@ -1,3 +1,3 @@
-FROM nicolargo/glances:alpine-dev
+FROM nicolargo/glances:latest as glancesminimal
COPY glances.conf /glances/conf/glances.conf
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT
diff --git a/docker-compose/docker-compose-with-traefik.yml b/docker-compose/docker-compose-with-traefik.yml
index 91a1d551..db29890f 100644
--- a/docker-compose/docker-compose-with-traefik.yml
+++ b/docker-compose/docker-compose-with-traefik.yml
@@ -15,7 +15,7 @@ services:
- "traefik.frontend.rule=Host:whoami.docker.localhost"
monitoring:
- image: nicolargo/glances:alpine-dev
+ image: nicolargo/glances:dev
restart: unless-stopped
pid: host
privileged: true
diff --git a/docker-files/alpine.Dockerfile b/docker-files/alpine.Dockerfile
index 90fe159e..d8f3e09c 100644
--- a/docker-files/alpine.Dockerfile
+++ b/docker-files/alpine.Dockerfile
@@ -33,12 +33,15 @@ RUN apk add --no-cache \
FROM build as buildRequirements
ARG PYTHON_VERSION
+
COPY requirements.txt .
-COPY webui-requirements.txt .
RUN pip3 install --no-cache-dir --user -r requirements.txt
+
# Minimal means no webui, but it break what is done previously (see #2155)
# So install the webui requirements...
+COPY webui-requirements.txt .
RUN pip3 install --no-cache-dir --user -r webui-requirements.txt
+
# As minimal image we want to monitor others docker containers
RUN pip3 install --no-cache-dir --user docker
@@ -48,10 +51,9 @@ RUN pip3 install --no-cache-dir --user glances
##############################################################################
-FROM build as buildOptionalRequirements
+FROM buildRequirements as buildOptionalRequirements
ARG PYTHON_VERSION
-COPY requirements.txt .
COPY optional-requirements.txt .
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt
@@ -70,9 +72,8 @@ COPY ./docker-compose/glances.conf /etc/glances.conf
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
-WORKDIR /glances
-
# Define default command.
+WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
##############################################################################
@@ -85,6 +86,8 @@ ARG PYTHON_VERSION
RUN apk add --no-cache \
python3 \
+ py3-packaging \
+ py3-dateutil \
curl \
lm-sensors \
wireless-tools \
@@ -94,10 +97,11 @@ COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf
-# EXPOSE PORT (XMLRPC only because WebUI is not available)
-EXPOSE 61209
+# EXPOSE PORT (XMLRPC / WebUI)
+EXPOSE 61209 61208
# Define default command.
+WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
##############################################################################
@@ -122,7 +126,6 @@ EXPOSE 61209 61208
RUN ln -sf /dev/stdout /tmp/glances-root.log \
&& ln -sf /dev/stderr /var/log/error.log
-WORKDIR /glances
-
# Define default command.
+WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
diff --git a/docker-files/debian.Dockerfile b/docker-files/debian.Dockerfile
deleted file mode 100644
index b8fbe540..00000000
--- a/docker-files/debian.Dockerfile
+++ /dev/null
@@ -1,127 +0,0 @@
-#
-# Glances Dockerfile (based on Debian)
-#
-# https://github.com/nicolargo/glances
-#
-
-# WARNING: the version should be set.
-# Ex: Python 3.10 for 3.10-slim-buster
-# Note: ENV is for future running containers. ARG for building your Docker image.
-
-ARG IMAGE_VERSION=3.10-slim-buster
-ARG PYTHON_VERSION=3.10
-FROM python:${IMAGE_VERSION} as build
-ARG PYTHON_VERSION
-
-# Install package
-RUN apt-get update && \
- apt-get install -y --no-install-recommends \
- python3-dev \
- curl \
- build-essential \
- lm-sensors \
- wireless-tools \
- smartmontools \
- iputils-ping && \
- apt-get clean && rm -rf /var/lib/apt/lists/*
-
-##############################################################################
-# Install the dependencies beforehand to make them cacheable
-
-FROM build as buildRequirements
-ARG PYTHON_VERSION
-COPY requirements.txt .
-COPY webui-requirements.txt .
-RUN pip3 install --no-cache-dir --user -r requirements.txt
-# Minimal means no webui, but it break what is done previously (see #2155)
-# So install the webui requirements...
-RUN pip3 install --no-cache-dir --user -r webui-requirements.txt
-# As minimal image we want to monitor others docker containers
-RUN pip3 install --no-cache-dir --user docker
-
-# Force install otherwise it could be cached without rerun
-ARG CHANGING_ARG
-RUN pip3 install --no-cache-dir --user glances
-
-##############################################################################
-
-FROM build as buildOptionalRequirements
-ARG PYTHON_VERSION
-
-COPY requirements.txt .
-COPY optional-requirements.txt .
-RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt
-
-##############################################################################
-# full image
-##############################################################################
-
-FROM build as full
-ARG PYTHON_VERSION
-
-COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
-COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/local/lib/python${PYTHON_VERSION}/site-packages/
-COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/local/lib/python${PYTHON_VERSION}/site-packages/
-COPY ./docker-compose/glances.conf /etc/glances.conf
-
-# EXPOSE PORT (XMLRPC / WebUI)
-EXPOSE 61209 61208
-
-WORKDIR /glances
-
-# Define default command.
-CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
-
-##############################################################################
-# minimal image
-##############################################################################
-
-# Create running images without any building dependency
-FROM python:${IMAGE_VERSION} as minimal
-ARG PYTHON_VERSION
-
-RUN apt-get update && \
- apt-get install -y --no-install-recommends \
- curl \
- lm-sensors \
- wireless-tools \
- smartmontools \
- iputils-ping && \
- apt-get clean && rm -rf /var/lib/apt/lists/*
-
-COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
-COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/local/lib/python${PYTHON_VERSION}/site-packages/
-COPY ./docker-compose/glances.conf /etc/glances.conf
-
-# EXPOSE PORT (XMLRPC)
-EXPOSE 61209
-
-# Define default command.
-CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
-
-##############################################################################
-# dev image
-##############################################################################
-
-FROM full as dev
-ARG PYTHON_VERSION
-
-COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
-COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
-COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
-COPY ./docker-compose/glances.conf /etc/glances.conf
-
-# Copy the current Glances source code
-COPY . /glances
-
-# EXPOSE PORT (XMLRPC / WebUI)
-EXPOSE 61209 61208
-
-# Forward access and error logs to Docker's log collector
-RUN ln -sf /dev/stdout /tmp/glances-root.log \
- && ln -sf /dev/stderr /var/log/error.log
-
-WORKDIR /glances
-
-# Define default command.
-CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT