Run tests within docker Dockerfile

This commit is contained in:
Daniel Schädler 2019-06-20 23:01:01 +02:00
parent d137340da5
commit a59e609d2c
2 changed files with 4 additions and 11 deletions

View File

@ -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:

View File

@ -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
RUN bundle exec rails db:migrate && bundle exec rails spec
CMD /bin/sh