From 075df53a337e234ad297b8e84ef583be3ab7f25e Mon Sep 17 00:00:00 2001 From: Lev Vereshchagin Date: Tue, 21 Dec 2021 13:44:28 +0300 Subject: [PATCH] Touch .build (#307), use scripts from nginx image to generate config and touch .build --- build/nginx/Dockerfile | 9 +++++---- build/nginx/entrypoint.sh | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100755 build/nginx/entrypoint.sh 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