From 9726e8b618c9d58b5b9c33f4798d8628be57968f Mon Sep 17 00:00:00 2001 From: kdeterme Date: Mon, 21 Sep 2026 14:50:18 +0200 Subject: [PATCH] refactor: move build metadata arguments to end of Dockerfile to improve cache efficiency --- Dockerfile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94c8cfa..92e86c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,15 +46,8 @@ ENV PROJ_DATA=/opt/conda/envs/loko-env/share/proj # Argument de build pour activer l'installation des librairies IA (ultralytics, OpenCV...) # Passer INSTALL_AI_LIBS=true dans le docker-compose pour les inclure ARG INSTALL_AI_LIBS=false -ARG GIT_COMMIT=unknown -ARG BUILD_DATE=unknown -ARG LOKO_VERSION=1.0.0 -ENV GIT_COMMIT_SHA=${GIT_COMMIT} -ENV BUILD_DATE=${BUILD_DATE} -ENV LOKO_VERSION=${LOKO_VERSION} - -# Copie et installation des dépendances Python +# Copie et installation des dépendances Python (mis en cache tant que requirements/ ne change pas) COPY requirements/ /app/requirements/ RUN pip install --no-cache-dir -r requirements/base.txt && \ if [ "$INSTALL_AI_LIBS" = "true" ]; then \ @@ -108,6 +101,15 @@ COPY loko/road_detection/templates/ /app/road_detection/templates/ COPY loko/*.py /app/ COPY loko/generated_passwords.txt* /app/ +# Métadonnées de build dynamiques (placées à la fin pour préserver le cache de build Docker) +ARG GIT_COMMIT=unknown +ARG BUILD_DATE=unknown +ARG LOKO_VERSION=1.0.0 + +ENV GIT_COMMIT_SHA=${GIT_COMMIT} +ENV BUILD_DATE=${BUILD_DATE} +ENV LOKO_VERSION=${LOKO_VERSION} + # Exposer le port par défaut EXPOSE 8000