From 238864b31b168e8f39dffc726ee3179dcdfe1c03 Mon Sep 17 00:00:00 2001
From: Pavel Kirilin <win10@list.ru>
Date: Wed, 18 Dec 2019 01:45:00 +0400
Subject: [PATCH] Fixed CI errors.

Signed-off-by: Pavel Kirilin <win10@list.ru>
---
 .gitlab-ci.yml          |  6 ++----
 Dockerfile              |  2 ++
 Makefile                | 15 +++++++++++++++
 docker-compose.test.yml | 10 +++++++---
 4 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b6509b3..fb87697 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,8 +7,7 @@ test:
   tags:
     - private
   script:
-    - make test
-    - cat target/site/jacoco/index.html
+    - make ci_test
 
 cleanup:
   stage: cleanup
@@ -16,5 +15,4 @@ cleanup:
   tags:
     - private
   script:
-    - sudo /bin/chown -R gitlab-runner target
-    - make clean_test
\ No newline at end of file
+    - make ci_clean_test
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index e72d324..2b68048 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,5 +9,7 @@ RUN sass --version
 COPY wait-for-it.sh /
 COPY wad.sh /
 
+COPY . /app
+
 RUN chmod 777 /wad.sh
 RUN chmod 777 /wait-for-it.sh
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 15e5d77..c77377b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,20 @@
 all: run
 
+_run_mvn_tests:
+	@mvn clean test -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
+
+_cat_jacoco_:
+	@cat /app/target/site/jacoco/index.html
+
+_ci_test: _run_mvn_tests _cat_jacoco_
+
+ci_test:
+	@docker-compose -f docker-compose.test.yml build
+	@docker-compose -f docker-compose.test.yml run ci_test_builder make _ci_test
+
+ci_clean_test:
+	@docker-compose -f docker-compose.test.yml down
+
 run:
 	@docker-compose -f docker-compose.yml up -d
 
diff --git a/docker-compose.test.yml b/docker-compose.test.yml
index c2d587d..0e1e30b 100644
--- a/docker-compose.test.yml
+++ b/docker-compose.test.yml
@@ -5,18 +5,22 @@ networks:
     name: 'tcn2'
 
 services:
-  test_builder:
+
+  ci_test_builder: &app
     build: .
     restart: always
     container_name: 'test_corporate_builder2'
     depends_on:
       - test_db
     working_dir: '/app'
-    volumes:
-      - .:/app
     networks:
       - test_corporate_network
 
+  test_builder:
+    <<: *app
+    volumes:
+      - .:/app
+
   test_db:
     image: 'postgres:10-alpine'
     container_name: 'test_corporate_db2'
-- 
GitLab