diff --git a/.env b/.env index 65d43bc2a..c0c3eaa32 100644 --- a/.env +++ b/.env @@ -3,4 +3,7 @@ STRAVA_CLIENT_SECRET=replace-me STRAVA_REFRESH_TOKEN=replace-me BLACKFIRE_CLIENT_ID=replace-me -BLACKFIRE_CLIENT_TOKEN=replace-me \ No newline at end of file +BLACKFIRE_CLIENT_TOKEN=replace-me + +#PUID=1000 +#PGID=1000 \ No newline at end of file diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 3768ba4b0..993a53550 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -34,6 +34,8 @@ RUN set -eux; \ COPY docker/app/config/php.ini ${PHP_INI_DIR}/php.ini COPY docker/app/config/Caddyfile /etc/frankenphp/Caddyfile +COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN chmod +x /usr/local/bin/docker-entrypoint.sh # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser ENV COMPOSER_ALLOW_SUPERUSER=1 @@ -59,4 +61,5 @@ RUN tar -xzf shoutrrr.tar.gz RUN chmod +x shoutrrr RUN mv shoutrrr /usr/bin/shoutrrr && rm shoutrrr.tar.gz +ENTRYPOINT ["docker-entrypoint.sh"] CMD [ "frankenphp", "run", "--config", "/etc/frankenphp/Caddyfile" ] \ No newline at end of file diff --git a/docker/app/docker-entrypoint.sh b/docker/app/docker-entrypoint.sh new file mode 100644 index 000000000..4789bac6e --- /dev/null +++ b/docker/app/docker-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +if [ -n "$PUID" ] && [ -n "$PGID" ] && [ "$(id -u)" = "0" ]; then + echo "Fixing permissions for PUID=$PUID PGID=$PGID..." + + chown -R "$PUID:$PGID" \ + /var/www \ + /config/caddy \ + /data/caddy || true +fi + +exec "$@" \ No newline at end of file diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 266f134ff..d7ca92f64 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -93,6 +93,10 @@ STRAVA_REFRESH_TOKEN=YOUR_REFRESH_TOKEN_OBTAINED_AFTER_AUTH_FLOW # Valid timezones can found under TZ Identifier column here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List TZ=Etc/GMT +# Uncomment and set these to run the container as a non-root user. +# PUID=your host UID +# PGID=your host GID + # !! IMPORTANT If you want to serve Statistics for Strava from a custom domain (not localhost), # uncomment the following lines and configure them accordingly: