refactor: move build metadata arguments to end of Dockerfile to improve cache efficiency
This commit is contained in:
parent
f23107e749
commit
9726e8b618
1 changed files with 10 additions and 8 deletions
18
Dockerfile
18
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...)
|
# Argument de build pour activer l'installation des librairies IA (ultralytics, OpenCV...)
|
||||||
# Passer INSTALL_AI_LIBS=true dans le docker-compose pour les inclure
|
# Passer INSTALL_AI_LIBS=true dans le docker-compose pour les inclure
|
||||||
ARG INSTALL_AI_LIBS=false
|
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}
|
# Copie et installation des dépendances Python (mis en cache tant que requirements/ ne change pas)
|
||||||
ENV BUILD_DATE=${BUILD_DATE}
|
|
||||||
ENV LOKO_VERSION=${LOKO_VERSION}
|
|
||||||
|
|
||||||
# Copie et installation des dépendances Python
|
|
||||||
COPY requirements/ /app/requirements/
|
COPY requirements/ /app/requirements/
|
||||||
RUN pip install --no-cache-dir -r requirements/base.txt && \
|
RUN pip install --no-cache-dir -r requirements/base.txt && \
|
||||||
if [ "$INSTALL_AI_LIBS" = "true" ]; then \
|
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/*.py /app/
|
||||||
COPY loko/generated_passwords.txt* /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
|
# Exposer le port par défaut
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue