Instead of wider perms, create and chown only servers.json

This commit is contained in:
Jinna Kiisuo 2024-01-30 13:10:13 +02:00
parent 9854c45fb2
commit 75f87692a2

View File

@ -13,9 +13,9 @@ COPY config/docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY scripts/docker/servers_from_env.sh /docker-entrypoint.d/30-shlink-servers-json.sh
COPY --from=node /shlink-web-client/build /usr/share/nginx/html
# Allow the nginx user to create new files in the html dir, but not modify existing files.
# This is required by 30-shlink-servers-json.sh
RUN chown :$UID /usr/share/nginx/html && chmod g+wx /usr/share/nginx/html
# This is required by 30-shlink-servers-json.sh to be writable for UID
RUN echo '[]' > /usr/share/nginx/html/servers.json \
&& chown $UID:0 /usr/share/nginx/html/servers.json
# Switch to non-privileged UID as the last step
USER $UID