Skip to content

Conversation

@tianon
Copy link
Member

@tianon tianon commented Oct 8, 2025

Changes:

Changes:

- docker-library/redmine@01d5e42: Fix for rails getting confused by an empty env var (docker-library/redmine#398)
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Diff for bd2c425:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index f67d2d3..bfe92cc 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -3,60 +3,60 @@ GitRepo: https://github.com/docker-library/redmine.git
 
 Tags: 5.1.10, 5.1, 5, 5.1.10-trixie, 5.1-trixie, 5-trixie
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: b5192c29c3c06bafb09b57eec4fa7f2f1a64ec03
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 5.1/trixie
 
 Tags: 5.1.10-alpine3.21, 5.1-alpine3.21, 5-alpine3.21
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 912d5e834802a5b3901bbc8bc642f8aff3ce91b8
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 5.1/alpine3.21
 
 Tags: 5.1.10-alpine3.22, 5.1-alpine3.22, 5-alpine3.22, 5.1.10-alpine, 5.1-alpine, 5-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 912d5e834802a5b3901bbc8bc642f8aff3ce91b8
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 5.1/alpine3.22
 
 Tags: 5.1.10-bookworm, 5.1-bookworm, 5-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 912d5e834802a5b3901bbc8bc642f8aff3ce91b8
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 5.1/bookworm
 
 Tags: 6.0.7, 6.0, 6.0.7-trixie, 6.0-trixie
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: a5559e1b8e4ff20203b73604dd91c3eb184899f1
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.0/trixie
 
 Tags: 6.0.7-alpine3.21, 6.0-alpine3.21
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 912d5e834802a5b3901bbc8bc642f8aff3ce91b8
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.0/alpine3.21
 
 Tags: 6.0.7-alpine3.22, 6.0-alpine3.22, 6.0.7-alpine, 6.0-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 912d5e834802a5b3901bbc8bc642f8aff3ce91b8
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.0/alpine3.22
 
 Tags: 6.0.7-bookworm, 6.0-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 912d5e834802a5b3901bbc8bc642f8aff3ce91b8
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.0/bookworm
 
 Tags: 6.1.0, 6.1, 6, latest, 6.1.0-trixie, 6.1-trixie, 6-trixie, trixie
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 782887eb82bfea15a4a6ea05569b81b323dd25cc
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.1/trixie
 
 Tags: 6.1.0-alpine3.21, 6.1-alpine3.21, 6-alpine3.21, alpine3.21
 Architectures: amd64, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 782887eb82bfea15a4a6ea05569b81b323dd25cc
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.1/alpine3.21
 
 Tags: 6.1.0-alpine3.22, 6.1-alpine3.22, 6-alpine3.22, alpine3.22, 6.1.0-alpine, 6.1-alpine, 6-alpine, alpine
 Architectures: amd64, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 782887eb82bfea15a4a6ea05569b81b323dd25cc
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.1/alpine3.22
 
 Tags: 6.1.0-bookworm, 6.1-bookworm, 6-bookworm, bookworm
 Architectures: amd64, arm64v8
-GitCommit: f0741776f38b451da162138348628b8cf44b5a23
+GitCommit: 01d5e42cea07875240d7a6f4f6b3a1e13fdcf411
 Directory: 6.1/bookworm
diff --git a/redmine_5-alpine/docker-entrypoint.sh b/redmine_5-alpine/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_5-alpine/docker-entrypoint.sh
+++ b/redmine_5-alpine/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_5-alpine3.21/docker-entrypoint.sh b/redmine_5-alpine3.21/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_5-alpine3.21/docker-entrypoint.sh
+++ b/redmine_5-alpine3.21/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_5-bookworm/docker-entrypoint.sh b/redmine_5-bookworm/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_5-bookworm/docker-entrypoint.sh
+++ b/redmine_5-bookworm/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_5-trixie/docker-entrypoint.sh b/redmine_5-trixie/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_5-trixie/docker-entrypoint.sh
+++ b/redmine_5-trixie/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_6.0-alpine/docker-entrypoint.sh b/redmine_6.0-alpine/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_6.0-alpine/docker-entrypoint.sh
+++ b/redmine_6.0-alpine/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_6.0-alpine3.21/docker-entrypoint.sh b/redmine_6.0-alpine3.21/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_6.0-alpine3.21/docker-entrypoint.sh
+++ b/redmine_6.0-alpine3.21/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_6.0-bookworm/docker-entrypoint.sh b/redmine_6.0-bookworm/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_6.0-bookworm/docker-entrypoint.sh
+++ b/redmine_6.0-bookworm/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_6.0-trixie/docker-entrypoint.sh b/redmine_6.0-trixie/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_6.0-trixie/docker-entrypoint.sh
+++ b/redmine_6.0-trixie/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_alpine/docker-entrypoint.sh b/redmine_alpine/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_alpine/docker-entrypoint.sh
+++ b/redmine_alpine/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_alpine3.21/docker-entrypoint.sh b/redmine_alpine3.21/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_alpine3.21/docker-entrypoint.sh
+++ b/redmine_alpine3.21/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_bookworm/docker-entrypoint.sh b/redmine_bookworm/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_bookworm/docker-entrypoint.sh
+++ b/redmine_bookworm/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate
diff --git a/redmine_trixie/docker-entrypoint.sh b/redmine_trixie/docker-entrypoint.sh
index 0bcee63..f956052 100755
--- a/redmine_trixie/docker-entrypoint.sh
+++ b/redmine_trixie/docker-entrypoint.sh
@@ -144,19 +144,26 @@ if [ -n "$isLikelyRedmine" ]; then
 	# just use the rails variable rather than trying to put it into a yml file
 	# https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438
 	# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable)
-	if [ -n "${SECRET_KEY_BASE}" ] && [ -n "${REDMINE_SECRET_KEY_BASE}" ]; then
+	if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then
 		echo >&2
 		echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply'
 		echo >&2
 	fi
-	: "${SECRET_KEY_BASE:=$REDMINE_SECRET_KEY_BASE}"
+	: "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}"
 	export SECRET_KEY_BASE
-	# generate SECRET_KEY_BASE if not set; this is not recommended unless the secret_token.rb is saved when container is recreated
-	if [ -z "$SECRET_KEY_BASE" ] && [ ! -f config/initializers/secret_token.rb ]; then
+	if [ -z "$SECRET_KEY_BASE" ]; then
+		# https://github.com/docker-library/redmine/issues/397
+		# empty string is truthy in ruby and so masks the generated fallback config
+		# https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454
+		unset SECRET_KEY_BASE
+		# generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated
+		if [ ! -f config/initializers/secret_token.rb ]; then
+			echo >&2
 			echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"'
-		unset SECRET_KEY_BASE # just in case
+			echo >&2
 			rake generate_secret_token
 		fi
+	fi
 
 	if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then
 		rake db:migrate

Relevant Maintainers:

@yosifkit yosifkit merged commit ad159fb into docker-library:master Oct 9, 2025
17 checks passed
@yosifkit yosifkit deleted the redmine branch October 9, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants