mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 10:12:55 +03:00
Refactor Docker image factory: from now, only Alpine images will be provided
This commit is contained in:
parent
bb9591c4d7
commit
eb8c0fd23c
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -96,7 +96,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: ['debian', 'alpine']
|
os: ['alpine']
|
||||||
tag: ${{ fromJson(needs.create_Docker_builds.outputs.tags) }}
|
tag: ${{ fromJson(needs.create_Docker_builds.outputs.tags) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -139,7 +139,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: ${{ env.PUSH_BRANCH == 'true' }}
|
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: |
|
build-args: |
|
||||||
CHANGING_ARG=${{ github.sha }}
|
CHANGING_ARG=${{ github.sha }}
|
||||||
context: .
|
context: .
|
||||||
|
16
Makefile
16
Makefile
@ -118,18 +118,13 @@ flatpak: venv-dev-upgrade ## Generate FlatPack JSON file
|
|||||||
# Docker
|
# Docker
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
|
|
||||||
docker: docker-alpine docker-debian
|
docker: docker-alpine
|
||||||
|
|
||||||
docker-alpine:
|
docker-alpine:
|
||||||
docker build --target full -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-full .
|
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 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 .
|
docker build --target dev -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-dev .
|
||||||
|
|
||||||
docker-debian:
|
|
||||||
docker build --target full -f ./docker-files/debian.Dockerfile -t glances:local-debian-full .
|
|
||||||
docker build --target minimal -f ./docker-files/debian.Dockerfile -t glances:local-debian-minimal .
|
|
||||||
docker build --target dev -f ./docker-files/debian.Dockerfile -t glances:local-debian-dev .
|
|
||||||
|
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
# Run
|
# Run
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
@ -152,15 +147,6 @@ run-docker-alpine-full: ## Start Glances Alpine Docker full in console mode
|
|||||||
run-docker-alpine-dev: ## Start Glances Alpine Docker dev in console mode
|
run-docker-alpine-dev: ## Start Glances Alpine Docker dev in console mode
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev
|
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev
|
||||||
|
|
||||||
run-docker-debian-minimal: ## Start Glances Debian Docker minimal in console mode
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-debian-minimal
|
|
||||||
|
|
||||||
run-docker-debian-full: ## Start Glances Debian Docker full in console mode
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-debian-full
|
|
||||||
|
|
||||||
run-docker-debian-dev: ## Start Glances Debian Docker dev in console mode
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-debian-dev
|
|
||||||
|
|
||||||
run-webserver: ## Start Glances in Web server mode
|
run-webserver: ## Start Glances in Web server mode
|
||||||
./venv/bin/python -m glances -C ./conf/glances.conf -w
|
./venv/bin/python -m glances -C ./conf/glances.conf -w
|
||||||
|
|
||||||
|
17
README.rst
17
README.rst
@ -193,25 +193,20 @@ If you want to support other distributions, please contribute to `glancesautoins
|
|||||||
Docker: the fun way
|
Docker: the fun way
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Glances containers are availables. You can use it to monitor your
|
Glances Docker images are availables. You can use it to monitor your
|
||||||
server and all your other containers!
|
server and all your containers !
|
||||||
|
|
||||||
Get the Glances container:
|
Get the Glances container:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
docker pull nicolargo/glances:alpine-latest-full
|
docker pull nicolargo/glances:latest-full
|
||||||
|
|
||||||
The following tags are availables:
|
The following tags are availables:
|
||||||
|
|
||||||
- *alpine-latest-full* for a full Alpine Glances image (latest release) with all dependencies
|
- *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
|
- *latest* for a basic Alpine Glances (latest release) version with minimal dependencies (Bottle and Docker)
|
||||||
- *alpine-latest* for a basic Alpine Glances (latest release) version with minimal dependencies
|
- *dev* for a basic Alpine Glances image (based on development branch) with all dependencies (Warning: may be instable)
|
||||||
- *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*).
|
|
||||||
|
|
||||||
Run last version of Glances container in *console mode*:
|
Run last version of Glances container in *console mode*:
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
FROM nicolargo/glances:alpine-dev
|
FROM nicolargo/glances:latest as glancesminimal
|
||||||
COPY glances.conf /glances/conf/glances.conf
|
COPY glances.conf /glances/conf/glances.conf
|
||||||
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT
|
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT
|
||||||
|
@ -15,7 +15,7 @@ services:
|
|||||||
- "traefik.frontend.rule=Host:whoami.docker.localhost"
|
- "traefik.frontend.rule=Host:whoami.docker.localhost"
|
||||||
|
|
||||||
monitoring:
|
monitoring:
|
||||||
image: nicolargo/glances:alpine-dev
|
image: nicolargo/glances:dev
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
pid: host
|
pid: host
|
||||||
privileged: true
|
privileged: true
|
||||||
|
@ -33,12 +33,15 @@ RUN apk add --no-cache \
|
|||||||
|
|
||||||
FROM build as buildRequirements
|
FROM build as buildRequirements
|
||||||
ARG PYTHON_VERSION
|
ARG PYTHON_VERSION
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
COPY webui-requirements.txt .
|
|
||||||
RUN pip3 install --no-cache-dir --user -r 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)
|
# Minimal means no webui, but it break what is done previously (see #2155)
|
||||||
# So install the webui requirements...
|
# So install the webui requirements...
|
||||||
|
COPY webui-requirements.txt .
|
||||||
RUN pip3 install --no-cache-dir --user -r webui-requirements.txt
|
RUN pip3 install --no-cache-dir --user -r webui-requirements.txt
|
||||||
|
|
||||||
# As minimal image we want to monitor others docker containers
|
# As minimal image we want to monitor others docker containers
|
||||||
RUN pip3 install --no-cache-dir --user docker
|
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
|
ARG PYTHON_VERSION
|
||||||
|
|
||||||
COPY requirements.txt .
|
|
||||||
COPY optional-requirements.txt .
|
COPY optional-requirements.txt .
|
||||||
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r 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 PORT (XMLRPC / WebUI)
|
||||||
EXPOSE 61209 61208
|
EXPOSE 61209 61208
|
||||||
|
|
||||||
WORKDIR /glances
|
|
||||||
|
|
||||||
# Define default command.
|
# Define default command.
|
||||||
|
WORKDIR /glances
|
||||||
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
|
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -85,6 +86,8 @@ ARG PYTHON_VERSION
|
|||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
python3 \
|
python3 \
|
||||||
|
py3-packaging \
|
||||||
|
py3-dateutil \
|
||||||
curl \
|
curl \
|
||||||
lm-sensors \
|
lm-sensors \
|
||||||
wireless-tools \
|
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 --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
|
COPY ./docker-compose/glances.conf /etc/glances.conf
|
||||||
|
|
||||||
# EXPOSE PORT (XMLRPC only because WebUI is not available)
|
# EXPOSE PORT (XMLRPC / WebUI)
|
||||||
EXPOSE 61209
|
EXPOSE 61209 61208
|
||||||
|
|
||||||
# Define default command.
|
# Define default command.
|
||||||
|
WORKDIR /glances
|
||||||
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
|
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 \
|
RUN ln -sf /dev/stdout /tmp/glances-root.log \
|
||||||
&& ln -sf /dev/stderr /var/log/error.log
|
&& ln -sf /dev/stderr /var/log/error.log
|
||||||
|
|
||||||
WORKDIR /glances
|
|
||||||
|
|
||||||
# Define default command.
|
# Define default command.
|
||||||
|
WORKDIR /glances
|
||||||
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
|
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
#
|
|
||||||
# Glances Dockerfile (based on Debian)
|
|
||||||
#
|
|
||||||
# https://github.com/nicolargo/glances
|
|
||||||
#
|
|
||||||
|
|
||||||
# WARNING: the version should be set.
|
|
||||||
# Ex: Python 3.11 for 3.11-slim-buster
|
|
||||||
# Note: ENV is for future running containers. ARG for building your Docker image.
|
|
||||||
|
|
||||||
ARG PYTHON_IMAGE_VERSION=3.11
|
|
||||||
ARG IMAGE_VERSION=${PYTHON_IMAGE_VERSION}-slim-buster
|
|
||||||
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
|
|
||||||
ARG PYTHON_IMAGE_VERSION
|
|
||||||
|
|
||||||
COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
|
|
||||||
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_IMAGE_VERSION}/site-packages /usr/local/lib/python${PYTHON_IMAGE_VERSION}/site-packages/
|
|
||||||
COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_IMAGE_VERSION}/site-packages /usr/local/lib/python${PYTHON_IMAGE_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
|
|
||||||
ARG PYTHON_IMAGE_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_IMAGE_VERSION}/site-packages /usr/local/lib/python${PYTHON_IMAGE_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
|
|
||||||
ARG PYTHON_IMAGE_VERSION
|
|
||||||
|
|
||||||
COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
|
|
||||||
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_IMAGE_VERSION}/site-packages /usr/lib/python${PYTHON_IMAGE_VERSION}/site-packages/
|
|
||||||
COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_IMAGE_VERSION}/site-packages /usr/lib/python${PYTHON_IMAGE_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
|
|
Loading…
Reference in New Issue
Block a user