diff --git a/Dockerfile b/Dockerfile index 4851d9e..357fafc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,7 @@ ENV RCLONE_AUTO_UPLOAD_PROVIDER= ENV RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads ENV RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K ENV RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G +ENV FIX_DATA_VOLUME_PERMISSIONS=false ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/ ADD conf /app/conf diff --git a/README.md b/README.md index 708a209..5685439 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ Then simply run `docker-compose up -d`, that's it! | `RCLONE_AUTO_UPLOAD_REMOTE_PATH` | The file folder in remote cloud storage provider, default `/downloads`| | `RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE` | Set the minimum file size of auto uploader, files smaller than it won't be uploaded, default `1K` | | `RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE` | Set the limit of the Max file can be uploaded to 3rd party storage provider, default `100G`. | +| `FIX_DATA_VOLUME_PERMISSIONS` | Default value is `false`. When set to `true`, the container will run `chown -R` command against `/data` folder and `PUID` and `PGID` you set. Please set it to `true` when container complains you don't have enough permissions to manage the files and folders you mounted.| ### Supported Volumes diff --git a/init.sh b/init.sh index 3379dcf..4ff9cbe 100755 --- a/init.sh +++ b/init.sh @@ -8,13 +8,19 @@ mkdir -p /app/.caddy mkdir -p /app/.cache mkdir -p /app/.cache/aria2 +echo "[INFO] Run chown against app related folders and user ${PUID}" + chown -R junv:junv \ /app \ /app/.caddy \ /app/.cache \ /usr/local \ - /var/log \ - /data + /var/log + +if [[ "${FIX_DATA_VOLUME_PERMISSIONS}" = "true" ]]; then + echo "[INFO] Setup user ${PUID} proper permissions for /data" + chown -R junv:junv /data +fi chmod +x /app/caddy.sh \ /app/rclone.sh \