From 8155cdd385382c15b03e27ea7801c3189a07eaae Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Sat, 26 Nov 2022 17:17:11 -0600 Subject: [PATCH] chore(docker): Introduce RECYCLARR_CREATE_CONFIG env var If enabled, will invoke `recyclarr create-config` on startup of the container if the `/config/recyclarr.yml` file does not exist. --- CHANGELOG.md | 2 ++ docker/Dockerfile | 3 ++- docker/scripts/prod/entrypoint.sh | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d6965e..e8c00985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ changes you need to make. - Named instances are now supported in configuration YAML. - New optional setting `repository.git_path` may be used to specify the path to a `git` executable. If not used, `PATH` will be searched. +- Docker: New `RECYCLARR_CREATE_CONFIG` environment variable which, if set to `true`, will + automatically create `/config/recyclarr.yml` on container start up. Default is `false`. ### Changed diff --git a/docker/Dockerfile b/docker/Dockerfile index 5bd8b20b..070d9255 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,8 @@ FROM mcr.microsoft.com/dotnet/runtime:7.0-alpine AS final # Required by environment and/or dotnet ENV PATH="${PATH}:/app/recyclarr" \ RECYCLARR_APP_DATA=/config \ - CRON_SCHEDULE="@daily" + CRON_SCHEDULE="@daily" \ + RECYCLARR_CREATE_CONFIG=false RUN set -ex; \ apk add --no-cache bash tzdata supercronic git; \ diff --git a/docker/scripts/prod/entrypoint.sh b/docker/scripts/prod/entrypoint.sh index 1d74f5ce..397e65b8 100644 --- a/docker/scripts/prod/entrypoint.sh +++ b/docker/scripts/prod/entrypoint.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash set -e +config=/config/recyclarr.yml +if [[ "$RECYCLARR_CREATE_CONFIG" = true && ! -f "$config" ]]; then + echo "Creating default recyclarr.yml file..." + recyclarr create-config +fi + # If the script has any arguments, invoke the CLI instead if [ "$#" -gt 0 ]; then recyclarr "$@"