diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff0f65e..997e828 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,6 +37,15 @@ rails e2e spec: alias: postgres - name: $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA alias: app + entrypoint: + - /bin/bash + - -lc + command: + - | + until getent hosts postgres >/dev/null 2>&1; do sleep 1; done + until bundle exec ruby -rpg -e "PG.connect(ENV.fetch('POSTGRES_URL')).close" >/dev/null 2>&1; do sleep 1; done + bundle exec rails db:migrate + exec bundle exec rails s -p 3000 -b 0.0.0.0 variables: POSTGRES_DB: turniere_blackbox POSTGRES_USER: turniere diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 6840fc3..a49494d 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -9,4 +9,5 @@ COPY . /app # Duplicate production environment to beta environment COPY config/environments/production.rb config/environments/beta.rb ENV RAILS_ENV production +EXPOSE 3000 CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0