i hope finally it works

This commit is contained in:
hllvc 2021-07-14 00:45:44 +02:00
parent 486db094bb
commit 755cb1e043
3 changed files with 5 additions and 14 deletions

View file

@ -2,4 +2,4 @@ FROM openjdk:8-jre-alpine
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
CMD [ "java", "-jar", "-Dspring.profiles.active=mysql" ,"app.jar" ] CMD [ "java", "-jar", "-Dspring.profiles.active=mysql" ,"app.jar" ]
COPY /target/app.jar . COPY app.jar .

15
Jenkinsfile vendored
View file

@ -2,10 +2,6 @@ pipeline {
agent any agent any
environment {
BUILD_CONTAINER_ID='test'
}
stages { stages {
stage('Build') { stage('Build') {
@ -14,16 +10,12 @@ pipeline {
filename 'Dockerfile.build' filename 'Dockerfile.build'
dir '.' dir '.'
additionalBuildArgs '-t petclinic-build' additionalBuildArgs '-t petclinic-build'
args '$HOME/.m2:/root/.m2' args '-v $HOME/.m2:/root/.m2'
} }
} }
steps { steps {
sh 'docker run -v $HOME/.m2:/root/.m2 -d petclinic-build > id' sh 'docker run -v $HOME/.m2:/root/.m2 --name petclinic-build petclinic-build'
script { sh 'docker cp petclinic-build:/build/spring-petclinic/target/app.jar .'
BUILD_CONTAINER_ID = sh(
script: 'echo $(cat id)'
).trim()
}
} }
} }
@ -35,7 +27,6 @@ pipeline {
} }
} }
steps { steps {
sh 'docker cp ${BUILD_CONTAINER_ID}:/build/target/app.jar .'
sh 'docker-compose up' sh 'docker-compose up'
/* sh 'docker run -it --rm -p 8080:8080 petclinic-run' */ /* sh 'docker run -it --rm -p 8080:8080 petclinic-run' */
} }

View file

@ -10,4 +10,4 @@ else
git checkout jenkins git checkout jenkins
fi fi
./mvnw package ./mvnw package -DskipTests