From f2dbb550d449b1c29e1ddaade5ca4e997f738745 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 30 Nov 2023 11:29:51 +0100 Subject: [PATCH 1/3] Allow selection of hdm container port --- Dockerfile | 8 +++++--- bin/entry.sh | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c517360c..6eca4f85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,10 @@ RUN apt update && apt install -y \ ENV APP_HOME /hdm ENV RAILS_ENV production +ENV HDM_PORT 3000 +ENV HDM_HOST 0.0.0.0 + +EXPOSE 3000 WORKDIR $APP_HOME @@ -27,6 +31,4 @@ COPY config/hdm.yml.template $APP_HOME/config/hdm.yml RUN bundle check || (bundle config set --local without 'development test' && bundle install) -EXPOSE 3000 - -CMD ["/hdm/bin/entry.sh"] +CMD ["/hdm/bin/entry.sh ${HDM_PORT} ${HDM_HOST}"] diff --git a/bin/entry.sh b/bin/entry.sh index 8cfbb2b8..ce41ee4f 100755 --- a/bin/entry.sh +++ b/bin/entry.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +HDM_PORT=$1 +HDM_HOST=$2 + bundle exec rake db:setup bundle exec rake hdm:assets @@ -8,4 +11,4 @@ bundle exec rails db:seed ./bin/fake_puppet_db & fi -bundle exec rails server -b 0.0.0.0 +bundle exec rails server -b $HDM_HOST -p $HDM_PORT From 390284256a8070553c9e366b5971517126992119 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 30 Nov 2023 11:35:32 +0100 Subject: [PATCH 2/3] shellcheck --- bin/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/entry.sh b/bin/entry.sh index ce41ee4f..ab7a99ab 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 831dd08933af1a247f66315a3eb42bc5e501a040 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 30 Nov 2023 13:27:07 +0100 Subject: [PATCH 3/3] use env var as expose port --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6eca4f85..21ae0315 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ ENV RAILS_ENV production ENV HDM_PORT 3000 ENV HDM_HOST 0.0.0.0 -EXPOSE 3000 +EXPOSE $HDM_PORT WORKDIR $APP_HOME