From 55b6a690dade7cc8ca3382801d20a6fea8cc6734 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 10 Jan 2024 10:40:16 +0100 Subject: [PATCH 1/2] fix setting hostname and port when using env vars in CMD, one must use `sh -c` to allow variable evaluation --- Dockerfile | 2 +- bin/entry.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 599c2949..6f0d14c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,4 +31,4 @@ COPY config/hdm.yml.template $APP_HOME/config/hdm.yml RUN bundle check || (bundle config set --local without 'development test' && bundle install) -CMD ["/hdm/bin/entry.sh", "${HDM_PORT}", "${HDM_HOST}"] +CMD ["sh", "-c", "/hdm/bin/entry.sh ${HDM_PORT} ${HDM_HOST}"] diff --git a/bin/entry.sh b/bin/entry.sh index ab7a99ab..ce41ee4f 100755 --- a/bin/entry.sh +++ b/bin/entry.sh @@ -11,4 +11,4 @@ bundle exec rails db:seed ./bin/fake_puppet_db & fi -bundle exec rails server -b "${HDM_HOST}" -p "${HDM_PORT}" +bundle exec rails server -b $HDM_HOST -p $HDM_PORT From 54a214fad780d8c5ff329f8b52307f98d4a4af2c Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 10 Jan 2024 10:49:43 +0100 Subject: [PATCH 2/2] we must exclude the shellcheck SC2086 reason: if we set the quoptes, the quotes will be also used by the container. the port must not have quotes. --- bin/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/entry.sh b/bin/entry.sh index ce41ee4f..5d08e424 100755 --- a/bin/entry.sh +++ b/bin/entry.sh @@ -10,5 +10,5 @@ if [[ "${DEVELOP}" -eq 1 ]]; then bundle exec rails db:seed ./bin/fake_puppet_db & fi - +# shellcheck disable=SC2086 bundle exec rails server -b $HDM_HOST -p $HDM_PORT