diff --git a/.gitignore b/.gitignore index e041fa529..d937c0abb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ +.docker-context/ *.log .idea/ *.iml diff --git a/Jenkinsfile b/Jenkinsfile index f30870d01..69d19047a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -161,7 +161,9 @@ pipeline { script { env.SELECTED_SERVICES.split(',').each { service -> String image = "${env.RESOLVED_IMAGE_REPOSITORY}/${service}:${env.IMAGE_TAG}" - sh "docker build -f deploy/docker/Dockerfile --build-arg BASE_IMAGE=${params.DOCKER_BASE_IMAGE} --build-arg JAR_FILE=${serviceJars[service]} -t ${image} ." + String contextDir = ".docker-context/${service}" + sh "mkdir -p '${contextDir}' && cp -f '${serviceJars[service]}' '${contextDir}/app.jar'" + sh "docker build -f deploy/docker/Dockerfile --build-arg BASE_IMAGE=${params.DOCKER_BASE_IMAGE} --build-arg JAR_FILE=app.jar -t ${image} '${contextDir}'" } if (params.ENVIRONMENT == 'test') {