diff --git a/build/nginx/Dockerfile b/build/nginx/Dockerfile index 86f1513a..abb6e890 100644 --- a/build/nginx/Dockerfile +++ b/build/nginx/Dockerfile @@ -75,11 +75,12 @@ COPY --from=base /root/frappe-bench/apps/frappe/frappe/public /usr/share/nginx/h COPY --from=frappe_prod_node_modules /root/frappe-bench/apps/frappe/node_modules /usr/share/nginx/html/assets/frappe/node_modules COPY --from=frappe_assets /root/frappe-bench/sites /usr/share/nginx/html -COPY nginx-template.conf / +# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/20-envsubst-on-templates.sh +COPY nginx-template.conf /etc/nginx/templates/default.conf.template +# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/docker-entrypoint.sh +COPY entrypoint.sh /docker-entrypoint.d/frappe-entrypoint.sh -USER 1001 - -CMD [ "/bin/sh" , "-c" , "envsubst '${BACKEND} ${SOCKETIO} ${FRAPPE_SITE_NAME_HEADER}' /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'" ] +USER 1000 diff --git a/build/nginx/entrypoint.sh b/build/nginx/entrypoint.sh new file mode 100755 index 00000000..78c15c9b --- /dev/null +++ b/build/nginx/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +# Update timestamp for ".build" file to enable caching assets: +# https://github.com/frappe/frappe/blob/52d8e6d952130eea64a9990b9fd5b1f6877be1b7/frappe/utils/__init__.py#L799-L805 +if [ -d /usr/share/nginx/html/sites ]; then + touch /usr/share/nginx/html/sites/.build -r /usr/share/nginx/html/.build +fi