Compare commits
12 Commits
feature/an
...
jenkins-sh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7e9360e2c | ||
|
|
6b1d998791 | ||
|
|
922c8df4c6 | ||
|
|
946909a1b0 | ||
|
|
5aab8caed6 | ||
|
|
63a5e576a8 | ||
|
|
aa6f394e65 | ||
|
|
15a05dc886 | ||
|
|
81b557f424 | ||
|
|
6e6e1fdcb6 | ||
|
|
75f780bd0c | ||
|
|
6a5572a5f7 |
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
FROM openjdk:8-jre-alpine
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
COPY ./target/java-maven-app-1.0-SNAPSHOT.jar /usr/app/
|
||||||
|
WORKDIR /usr/app
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-jar", "java-maven-app-1.0-SNAPSHOT.jar"]
|
||||||
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
|
library identifier: 'jenkins-shared-library@master', retriever: modernSCM(
|
||||||
|
[$class: 'GitSCMSource',
|
||||||
|
remote: 'https://gitlab.com/nanuchi/jenkins-shared-library.git',
|
||||||
|
credentialsId: 'gitlab-credentials'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def gv
|
def gv
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
@@ -16,14 +26,16 @@ pipeline {
|
|||||||
stage("build jar") {
|
stage("build jar") {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
gv.buildJar()
|
buildJar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("build image") {
|
stage("build and push image") {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
gv.buildImage()
|
buildImage 'nanajanashia/demo-app:jma-3.0'
|
||||||
|
dockerLogin()
|
||||||
|
dockerPush 'nanajanashia/demo-app:jma-3.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,5 +46,5 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
def buildJar() {
|
|
||||||
echo "building the application..."
|
|
||||||
sh 'mvn package'
|
|
||||||
}
|
|
||||||
|
|
||||||
def buildImage() {
|
|
||||||
echo "building the docker image..."
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'docker-hub-repo', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
|
|
||||||
sh 'docker build -t nanajanashia/demo-app:jma-2.0 .'
|
|
||||||
sh "echo $PASS | docker login -u $USER --password-stdin"
|
|
||||||
sh 'docker push nanajanashia/demo-app:jma-2.0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def deployApp() {
|
def deployApp() {
|
||||||
echo 'deploying the application...'
|
echo 'deploying the application...'
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
|||||||
Reference in New Issue
Block a user