Lint Dockerfile

This commit is contained in:
nicolargo 2025-06-29 13:22:35 +02:00
parent 1268b58bbc
commit 28e82eb237
2 changed files with 20 additions and 20 deletions

View File

@ -14,7 +14,7 @@ ARG PYTHON_VERSION=3.12
############################################################################## ##############################################################################
# Base layer to be used for building dependencies and the release images # 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 # Upgrade the system
RUN apk update \ RUN apk update \
@ -34,7 +34,7 @@ RUN apk add --no-cache \
# BUILD Stages # BUILD Stages
############################################################################## ##############################################################################
# BUILD: Base image shared by all build images # BUILD: Base image shared by all build images
FROM base as build FROM base AS build
ARG PYTHON_VERSION ARG PYTHON_VERSION
RUN apk add --no-cache \ 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 # BUILD: Install the minimal image deps
FROM build as buildMinimal FROM build AS buildminimal
ARG PYTHON_VERSION ARG PYTHON_VERSION
RUN /venv-build/bin/python${PYTHON_VERSION} -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \ 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 # BUILD: Install all the deps
FROM build as buildFull FROM build AS buildfull
ARG PYTHON_VERSION ARG PYTHON_VERSION
# Required for optional dependency cassandra-driver # 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 # RELEASE Stages
############################################################################## ##############################################################################
# Base image shared by all releases # Base image shared by all releases
FROM base as release FROM base AS release
ARG PYTHON_VERSION ARG PYTHON_VERSION
# Copy source code and config file # Copy source code and config file
@ -122,21 +122,21 @@ CMD /venv/bin/python3 -m glances $GLANCES_OPT
################################################################################ ################################################################################
# RELEASE: minimal # RELEASE: minimal
FROM release as minimal FROM release AS minimal
COPY --from=buildMinimal /venv /venv COPY --from=buildminimal /venv /venv
################################################################################ ################################################################################
# RELEASE: full # RELEASE: full
FROM release as full FROM release AS full
RUN apk add --no-cache libzmq RUN apk add --no-cache libzmq
COPY --from=buildFull /venv /venv COPY --from=buildfull /venv /venv
################################################################################ ################################################################################
# RELEASE: dev - to be compatible with CI # RELEASE: dev - to be compatible with CI
FROM full as dev FROM full AS dev
# Add the specific logger configuration file for Docker dev # Add the specific logger configuration file for Docker dev
# All logs will be forwarded to stdout # 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 ENV LOG_CFG=/app/docker-logger.json
WORKDIR /app WORKDIR /app
CMD /venv/bin/python3 -m glances $GLANCES_OPT CMD /venv/bin/python3 -m glances $GLANCES_OPT

View File

@ -13,7 +13,7 @@ ARG PYTHON_VERSION=3.12
############################################################################## ##############################################################################
# Base layer to be used for building dependencies and the release images # 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 ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \ RUN apt-get update \
@ -32,7 +32,7 @@ RUN apt-get update \
# BUILD Stages # BUILD Stages
############################################################################## ##############################################################################
# BUILD: Base image shared by all build images # BUILD: Base image shared by all build images
FROM base as build FROM base AS build
ARG PYTHON_VERSION ARG PYTHON_VERSION
ARG DEBIAN_FRONTEND=noninteractive 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 # BUILD: Install the minimal image deps
FROM build as buildMinimal FROM build AS buildminimal
ARG PYTHON_VERSION ARG PYTHON_VERSION
RUN python3 -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \ 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 # BUILD: Install all the deps
FROM build as buildFull FROM build AS buildfull
ARG PYTHON_VERSION ARG PYTHON_VERSION
RUN python3 -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \ 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 # RELEASE Stages
############################################################################## ##############################################################################
# Base image shared by all releases # Base image shared by all releases
FROM base as release FROM base AS release
ARG PYTHON_VERSION ARG PYTHON_VERSION
# Copy Glances source code and config file # Copy Glances source code and config file
@ -106,14 +106,14 @@ CMD /venv/bin/python3 -m glances $GLANCES_OPT
################################################################################ ################################################################################
# RELEASE: minimal # RELEASE: minimal
FROM release as minimal FROM release AS minimal
ARG PYTHON_VERSION ARG PYTHON_VERSION
COPY --from=buildMinimal /venv /venv COPY --from=buildMinimal /venv /venv
################################################################################ ################################################################################
# RELEASE: full # RELEASE: full
FROM release as full FROM release AS full
ARG PYTHON_VERSION ARG PYTHON_VERSION
RUN apt-get update \ RUN apt-get update \
@ -121,11 +121,11 @@ RUN apt-get update \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY --from=buildFull /venv /venv COPY --from=buildfull /venv /venv
################################################################################ ################################################################################
# RELEASE: dev - to be compatible with CI # RELEASE: dev - to be compatible with CI
FROM full as dev FROM full AS dev
ARG PYTHON_VERSION ARG PYTHON_VERSION
# Add the specific logger configuration file for Docker dev # Add the specific logger configuration file for Docker dev