From 28e82eb23737ee54e4c56b8f75ab24d4c9a040e9 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 29 Jun 2025 13:22:35 +0200 Subject: [PATCH] Lint Dockerfile --- docker-files/alpine.Dockerfile | 22 +++++++++++----------- docker-files/ubuntu.Dockerfile | 18 +++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docker-files/alpine.Dockerfile b/docker-files/alpine.Dockerfile index f750ef04..08b54ac7 100644 --- a/docker-files/alpine.Dockerfile +++ b/docker-files/alpine.Dockerfile @@ -14,7 +14,7 @@ ARG PYTHON_VERSION=3.12 ############################################################################## # Base layer to be used for building dependencies and the release images -FROM alpine:${IMAGE_VERSION} as base +FROM alpine:${IMAGE_VERSION} AS base # Upgrade the system RUN apk update \ @@ -34,7 +34,7 @@ RUN apk add --no-cache \ # BUILD Stages ############################################################################## # BUILD: Base image shared by all build images -FROM base as build +FROM base AS build ARG PYTHON_VERSION RUN apk add --no-cache \ @@ -70,7 +70,7 @@ COPY requirements.txt docker-requirements.txt webui-requirements.txt optional-re ############################################################################## # BUILD: Install the minimal image deps -FROM build as buildMinimal +FROM build AS buildminimal ARG PYTHON_VERSION RUN /venv-build/bin/python${PYTHON_VERSION} -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \ @@ -80,7 +80,7 @@ RUN /venv-build/bin/python${PYTHON_VERSION} -m pip install --target="/venv/lib/p ############################################################################## # BUILD: Install all the deps -FROM build as buildFull +FROM build AS buildfull ARG PYTHON_VERSION # Required for optional dependency cassandra-driver @@ -96,7 +96,7 @@ RUN /venv-build/bin/python${PYTHON_VERSION} -m pip install --target="/venv/lib/p # RELEASE Stages ############################################################################## # Base image shared by all releases -FROM base as release +FROM base AS release ARG PYTHON_VERSION # Copy source code and config file @@ -122,21 +122,21 @@ CMD /venv/bin/python3 -m glances $GLANCES_OPT ################################################################################ # RELEASE: minimal -FROM release as minimal +FROM release AS minimal -COPY --from=buildMinimal /venv /venv +COPY --from=buildminimal /venv /venv ################################################################################ # RELEASE: full -FROM release as full +FROM release AS full RUN apk add --no-cache libzmq -COPY --from=buildFull /venv /venv +COPY --from=buildfull /venv /venv ################################################################################ # RELEASE: dev - to be compatible with CI -FROM full as dev +FROM full AS dev # Add the specific logger configuration file for Docker dev # All logs will be forwarded to stdout @@ -144,4 +144,4 @@ COPY ./docker-files/docker-logger.json /app ENV LOG_CFG=/app/docker-logger.json WORKDIR /app -CMD /venv/bin/python3 -m glances $GLANCES_OPT \ No newline at end of file +CMD /venv/bin/python3 -m glances $GLANCES_OPT diff --git a/docker-files/ubuntu.Dockerfile b/docker-files/ubuntu.Dockerfile index 93320faa..fc3713e6 100644 --- a/docker-files/ubuntu.Dockerfile +++ b/docker-files/ubuntu.Dockerfile @@ -13,7 +13,7 @@ ARG PYTHON_VERSION=3.12 ############################################################################## # Base layer to be used for building dependencies and the release images -FROM ubuntu:${IMAGE_VERSION} as base +FROM ubuntu:${IMAGE_VERSION} AS base ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ @@ -32,7 +32,7 @@ RUN apt-get update \ # BUILD Stages ############################################################################## # BUILD: Base image shared by all build images -FROM base as build +FROM base AS build ARG PYTHON_VERSION ARG DEBIAN_FRONTEND=noninteractive @@ -59,7 +59,7 @@ COPY requirements.txt docker-requirements.txt webui-requirements.txt optional-re ############################################################################## # BUILD: Install the minimal image deps -FROM build as buildMinimal +FROM build AS buildminimal ARG PYTHON_VERSION RUN python3 -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \ @@ -69,7 +69,7 @@ RUN python3 -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-pack ############################################################################## # BUILD: Install all the deps -FROM build as buildFull +FROM build AS buildfull ARG PYTHON_VERSION RUN python3 -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \ @@ -80,7 +80,7 @@ RUN python3 -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-pack # RELEASE Stages ############################################################################## # Base image shared by all releases -FROM base as release +FROM base AS release ARG PYTHON_VERSION # Copy Glances source code and config file @@ -106,14 +106,14 @@ CMD /venv/bin/python3 -m glances $GLANCES_OPT ################################################################################ # RELEASE: minimal -FROM release as minimal +FROM release AS minimal ARG PYTHON_VERSION COPY --from=buildMinimal /venv /venv ################################################################################ # RELEASE: full -FROM release as full +FROM release AS full ARG PYTHON_VERSION RUN apt-get update \ @@ -121,11 +121,11 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY --from=buildFull /venv /venv +COPY --from=buildfull /venv /venv ################################################################################ # RELEASE: dev - to be compatible with CI -FROM full as dev +FROM full AS dev ARG PYTHON_VERSION # Add the specific logger configuration file for Docker dev