another fix

This commit is contained in:
hllvc 2021-07-13 17:40:45 +02:00
parent ed4de7150a
commit dd650e987d
3 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,5 @@
FROM openjdk:8-jdk-alpine FROM openjdk:8-jdk-alpine
WORKDIR /build WORKDIR /build
CMD [ "./build.sh" ] CMD [ "./build.sh" ]
RUN apk add bash git
COPY build.sh . COPY build.sh .

9
Jenkinsfile vendored
View file

@ -10,7 +10,7 @@ pipeline {
filename 'Dockerfile.build' filename 'Dockerfile.build'
dir '.' dir '.'
additionalBuildArgs '-t petclinic-build' additionalBuildArgs '-t petclinic-build'
args '-v $HOME/.m2:/root/.m2 --name petclinic-build' args '-v $HOME/.m2:/root/.m2'
} }
} }
steps { steps {
@ -24,14 +24,13 @@ pipeline {
agent { agent {
docker { docker {
image 'docker:dind' image 'docker:dind'
args '-v /var/run/docker.sock:/var/run/docker.sock' args '-v /var/run/docker.sock:/var/run/docker.sock --user root'
} }
} }
steps { steps {
sh """docker run -d --rm \ sh """docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
--name petclinic-build --name petclinic-build petclinic-build"""
petclinic-build"""
sh 'docker cp petclinic-build:/build/target/app.jar .' sh 'docker cp petclinic-build:/build/target/app.jar .'
} }
} }

View file

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