From aa2840fa8e60d1d8bdc05a03d5f886b79738347b Mon Sep 17 00:00:00 2001 From: nicolasgere Date: Wed, 28 Aug 2024 13:23:17 -0700 Subject: [PATCH] Fix docker cache image for dev (#1105) * Change model copy dockerfile for improving cache --- truss/templates/server.Dockerfile.jinja | 8 +++++--- truss/test_data/server.Dockerfile | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/truss/templates/server.Dockerfile.jinja b/truss/templates/server.Dockerfile.jinja index d3c5e969a..cac0f64d5 100644 --- a/truss/templates/server.Dockerfile.jinja +++ b/truss/templates/server.Dockerfile.jinja @@ -75,17 +75,19 @@ COPY ./{{config.data_dir}} /app/data {%- endif %} COPY ./server /app -{%- if model_dir_exists %} -COPY ./{{ config.model_module_dir }} /app/model -{%- endif %} + COPY ./config.yaml /app/config.yaml {%- if config.live_reload %} COPY ./control /control RUN python3 -m venv /control/.env \ && /control/.env/bin/pip3 install -r /control/requirements.txt {%- endif %} +{%- if model_dir_exists %} +COPY ./{{ config.model_module_dir }} /app/model +{%- endif %} {% endblock %} + {% block run %} {%- if config.live_reload %} ENV HASH_TRUSS {{truss_hash}} diff --git a/truss/test_data/server.Dockerfile b/truss/test_data/server.Dockerfile index 7be57e609..3ba3b3caf 100644 --- a/truss/test_data/server.Dockerfile +++ b/truss/test_data/server.Dockerfile @@ -34,8 +34,8 @@ WORKDIR $APP_HOME # Copy data before code for better caching COPY ./data /app/data COPY ./server /app -COPY ./model /app/model COPY ./config.yaml /app/config.yaml +COPY ./model /app/model COPY ./packages /packages