Update Debian container to Python 3.11

This commit is contained in:
nicolargo 2022-10-29 10:55:59 +02:00
parent e0cc9710a4
commit 6116c2cc44
2 changed files with 28 additions and 9 deletions

View File

@ -118,11 +118,18 @@ flatpak: venv-dev-upgrade ## Generate FlatPack JSON file
# Docker
# ===================================================================
docker:
docker: docker-alpine docker-debian
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 .
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
# ===================================================================
@ -145,6 +152,15 @@ run-docker-alpine-full: ## Start Glances Alpine Docker full 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
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
./venv/bin/python -m glances -C ./conf/glances.conf -w

View File

@ -5,11 +5,11 @@
#
# WARNING: the version should be set.
# Ex: Python 3.10 for 3.10-slim-buster
# Ex: Python 3.11 for 3.11-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
ARG PYTHON_IMAGE_VERSION=3.11
ARG IMAGE_VERSION=${PYTHON_IMAGE_VERSION}-slim-buster
FROM python:${IMAGE_VERSION} as build
ARG PYTHON_VERSION
@ -58,10 +58,11 @@ RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requi
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_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 --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)
@ -79,6 +80,7 @@ CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
# 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 \
@ -90,7 +92,7 @@ RUN apt-get update && \
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 --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)
@ -105,10 +107,11 @@ CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
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_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 --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