aproach with build.sh

This commit is contained in:
hllvc 2021-07-12 15:27:22 +02:00
parent c38472dc83
commit 2f13f2ee76
4 changed files with 18 additions and 7 deletions

View file

@ -1,5 +1,3 @@
FROM openjdk:8-jdk-alpine
WORKDIR /build
COPY . .
RUN ./mvnw -B -e dependency:go-offline
RUN ./mvnw package
CMD [ "./build.sh" ]

View file

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

4
Jenkinsfile vendored
View file

@ -9,11 +9,11 @@ pipeline {
dockerfile {
filename 'Dockerfile.build'
dir '.'
args '-v $HOME/.m2:/root/.m2 --name petclinic_build'
args '-v $HOME/.m2:/root/.m2'
}
}
steps {
sh 'docker cp petclinic_build:/build/target/app.jar .'
echo 'Build done'
}
}

13
build.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
if [[ -f spring-petclinic ]]; then
cd spring-petclinic
git chekcout jenkins
git pull jenkins
else
git clone https://github.com/hllvc/spring-petclinic.git
cd spring-petclinic
git checkout jenkins
fi
./mvnw package