From a59e609d2c6b47276118620081efde4f458133c9 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Thu, 20 Jun 2019 23:01:01 +0200 Subject: [PATCH] Run tests within docker Dockerfile --- .gitlab-ci.yml | 12 ++---------- docker/test/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa462e8..8f56421 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,5 @@ stages: - - build - - test + - build & test - deploy services: @@ -11,7 +10,7 @@ variables: DOCKER_DRIVER: overlay2 kaniko: - stage: build + stage: build & test image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] @@ -21,13 +20,6 @@ kaniko: - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/docker/development/Dockerfile --destination $CI_REGISTRY_IMAGE/development --destination $CI_REGISTRY_IMAGE/development/commits:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE/development/branches:$CI_COMMIT_REF_SLUG - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/docker/test/Dockerfile --destination $CI_REGISTRY_IMAGE/test --destination $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE/test/branches:$CI_COMMIT_REF_SLUG -rails spec: - stage: test - image: registry.gitlab.com/turniere/turniere-backend/test - script: - - bundle exec rails db:migrate - - bundle exec rails spec - kubernetes: stage: deploy only: diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile index e3a2b0f..18e16b0 100644 --- a/docker/test/Dockerfile +++ b/docker/test/Dockerfile @@ -3,4 +3,5 @@ FROM registry.gitlab.com/turniere/turniere-backend/development WORKDIR /app RUN bundle install --deployment --with test ENV RAILS_ENV test -CMD bundle exec rails db:migrate && bundle exec rails spec \ No newline at end of file +RUN bundle exec rails db:migrate && bundle exec rails spec +CMD /bin/sh