From e7889f84633d8d6a7eae6eef470821a945844657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vorburger=20=E2=9B=91=EF=B8=8F?= Date: Sun, 17 May 2020 11:33:29 +0200 Subject: [PATCH] copy .git/** into build container so git.properties can be generated [FINERACT-983] (#904) --- .dockerignore | 9 +++------ .gitignore | 1 + .travis.yml | 3 ++- Dockerfile | 16 +--------------- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.dockerignore b/.dockerignore index ed4cfd165..23278abfa 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,12 +18,9 @@ build/* .gradle/* +*.jar +*.war + # Incremental "docker build" is faster if we can modify the Dockerfile # without "COPY ." re-transferring everything into the builder container. Dockerfile - -# https://github.com/containers/buildah/issues/1582 -.git/* -.git/*/* -.git/*/*/* -.git/*/*/*/* diff --git a/.gitignore b/.gitignore index eb4aa3925..84133548b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ catalina.base_IS_UNDEFINED/ keystore.jks bin/ fineract-provider/src/main/resources/application.properties +.lock diff --git a/.travis.yml b/.travis.yml index f3da52d34..3abb2b39b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,5 +71,6 @@ script: # using "&&" instead of several "-" means that integrationTest does not run if test fails, # and Docker test does not run if integration test fails, which makes PR failure easier to understand. # @see https://docs.travis-ci.com/user/job-lifecycle/#customizing-the-build-phase - - ./gradlew --console=plain licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 30s && http --verify=no --timeout 240 --check-status get https://localhost:8443/fineract-provider/actuator/health + - ./gradlew --console=plain licenseMain licenseTest licenseIntegrationTest check && ./gradlew --console=plain integrationTest --fail-fast && sudo service mysql stop && docker-compose build && docker-compose up -d && sleep 30s && http --verify=no --timeout 240 --check-status get https://localhost:8443/fineract-provider/actuator/health && (( $(http --verify=no --timeout 30 --check-status --body get https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 )) # We stop the mysql system service when running the Docker test to avoid port 3306 conflicts (unless we run the mysql in docker-compose on another port; req. FINERACT-773) +# The fany /actuator/info test makes sure that has more than 100 characters of JSON to test that the git.properties worked (see FINERACT-983) diff --git a/Dockerfile b/Dockerfile index 4b6137476..712648c95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,22 +17,8 @@ # FROM openjdk:11 AS builder -# COPY . fineract is slow e.g. when using Podman instead of Docker (because it doesn't honor .dockerignore and copies all of .git/** into the container..), so let's explicitly list only what we need: -COPY fineract-provider/src/main fineract/fineract-provider/src/main/ -COPY fineract-provider/config fineract/fineract-provider/config/ -COPY fineract-provider/gradle fineract/fineract-provider/gradle/ -COPY fineract-provider/properties fineract/fineract-provider/properties/ -COPY fineract-provider/[bd]*.gradle fineract/fineract-provider/ -COPY fineract-provider/gradle.properties fineract/fineract-provider/ -COPY fineract-provider/gradlew fineract/fineract-provider/ -COPY gradle* fineract/ -COPY settings.gradle fineract/ -COPY licenses fineract/licenses/ -COPY *LICENSE* fineract/ -COPY *NOTICE* fineract/ - +COPY . fineract WORKDIR fineract -# RUN find . RUN ./gradlew --no-daemon -x rat -x test war # =========================================