Skip to content

Commit 6d6dfde

Browse files
Reapply fix to allow sync to packages (#1996)
* Allow "truss watch" to succeed on external package dirs (#1987) * add /packages to app ownership * reverse order of chown directories * apply review comments * fix test expectation * create packages directory unconditionally * fix test expectation
1 parent 01795e7 commit 6d6dfde

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

truss/templates/base.Dockerfile.jinja

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ WORKDIR $APP_HOME
115115
{% endblock %}
116116

117117

118+
{% set packages_dir = "/packages" %}
119+
RUN mkdir -p {{ packages_dir }}
118120
{% block bundled_packages_copy %}
119121
{%- if bundled_packages_dir_exists %}
120-
COPY --chown={{ default_owner }} ./{{ config.bundled_packages_dir }} /packages
122+
COPY --chown={{ default_owner }} ./{{ config.bundled_packages_dir }} {{ packages_dir }}
121123
{%- endif %}
122124
{% endblock %}
123125

truss/templates/server.Dockerfile.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ COPY --chown={{ default_owner }} ./{{ config.model_module_dir }} ${APP_HOME}/mod
104104
{# Macro to change ownership of directories and switch to regular user #}
105105
{%- macro chown_and_switch_to_regular_user_if_enabled(additional_chown_dirs=[]) -%}
106106
{%- if non_root_user %}
107-
RUN chown -R {{ app_username }}:{{ app_username }} {% for dir in additional_chown_dirs %}{{ dir }} {% endfor %}${HOME} ${APP_HOME}
107+
RUN chown -R {{ app_username }}:{{ app_username }} ${HOME} ${APP_HOME} {{ packages_dir }} {% for dir in additional_chown_dirs %}{{ dir }} {% endfor %}
108108
USER {{ app_username }}
109109
{%- endif %} {#- endif non_root_user #}
110110
{%- endmacro -%}

truss/tests/test_data/server.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ COPY --chown= ./data ${APP_HOME}/data
3636
COPY --chown= ./server ${APP_HOME}
3737
COPY --chown= ./config.yaml ${APP_HOME}/config.yaml
3838
COPY --chown= ./model ${APP_HOME}/model
39+
RUN mkdir -p /packages
3940
COPY --chown= ./packages /packages
4041
ENV INFERENCE_SERVER_PORT="8080"
4142
ENV SERVER_START_CMD="/usr/local/bin/python3 /app/main.py"

0 commit comments

Comments
 (0)