diff --git a/Dockerfile b/Dockerfile index 7389dee..19aa30c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -207,6 +207,7 @@ EXPOSE ${PORT} ENV SIGNAL_CLI_CONFIG_DIR=/home/.local/share/signal-cli ENV SIGNAL_CLI_UID=1000 ENV SIGNAL_CLI_GID=1000 +ENV SIGNAL_CLI_CHOWN_ON_STARTUP=true ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index 448e239..a80b698 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,8 @@ There are a bunch of environmental variables that can be set inside the docker c * `SIGNAL_CLI_GID`: Specifies the gid of the `signal-api` group inside the docker container. Defaults to `1000` +* `SIGNAL_CLI_CHOWN_ON_STARTUP`: If set to `false` will skip the sometimes time consuming chown on startup. Defaults to `true` + * `SWAGGER_HOST`: The host that's used in the Swagger UI for the interactive examples (and useful when this runs behind a reverse proxy). Defaults to SWAGGER_IP:PORT. * `SWAGGER_IP`: The IP that's used in the Swagger UI for the interactive examples. Defaults to the container ip. diff --git a/entrypoint.sh b/entrypoint.sh index f8a7c42..05363d3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,8 +8,13 @@ set -e usermod -u ${SIGNAL_CLI_UID} signal-api groupmod -o -g ${SIGNAL_CLI_GID} signal-api -# Fix permissions to ensure backward compatibility -chown ${SIGNAL_CLI_UID}:${SIGNAL_CLI_GID} -R ${SIGNAL_CLI_CONFIG_DIR} +# Fix permissions to ensure backward compatibility if SIGNAL_CLI_CHOWN_ON_STARTUP is not set to "false" +if [ "$SIGNAL_CLI_CHOWN_ON_STARTUP" != "false" ]; then + echo "Changing ownership of ${SIGNAL_CLI_CONFIG_DIR} to ${SIGNAL_CLI_UID}:${SIGNAL_CLI_GID}" + chown ${SIGNAL_CLI_UID}:${SIGNAL_CLI_GID} -R ${SIGNAL_CLI_CONFIG_DIR} +else + echo "Skipping chown on startup since SIGNAL_CLI_CHOWN_ON_STARTUP is set to 'false'" +fi # Show warning on docker exec cat <> /root/.bashrc