From 33e29bc81a5a0cb736b96d3477c83ad4ecd4c2aa Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 10 Jan 2024 11:34:40 +0100 Subject: [PATCH] fix setting hostname and port (#257) * fix setting hostname and port when using env vars in CMD, one must use `sh -c` to allow variable evaluation * 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. --- Dockerfile | 2 +- bin/entry.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 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..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 - -bundle exec rails server -b "${HDM_HOST}" -p "${HDM_PORT}" +# shellcheck disable=SC2086 +bundle exec rails server -b $HDM_HOST -p $HDM_PORT