Skip to content

Commit 225e727

Browse files
author
root
committed
ouf
1 parent 32e3584 commit 225e727

3 files changed

Lines changed: 64 additions & 8 deletions

File tree

dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
FROM tomcat:latest
2-
LABEL maintainer="Your Name <[email protected]>
3-
RUN rm -rf /usr/local/tomcat/webapps/*
4-
COPY ./path/to/sampleapp.war /usr/local/tomcat/webapps/ROOT.war
5-
EXPOSE 8080
6-
CMD ["catalina.sh", "run"]
1+
FROM nginx:latest
2+
COPY index.html /usr/share/nginx/html
3+
VOLUME bank1:/usr/share/nginx/html
4+
EXPOSE 4000:80
5+
CMD ["nginx", "-g", "daemon off;"]

jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pipeline {
3232
stage('Docker build') {
3333
steps {
3434
echo "building image"
35-
sh 'docker build -t javapp:${BUILD_NUMBER} .'
35+
sh 'docker build -t sampleapp:${BUILD_NUMBER} .'
3636
}
3737
}
3838
stage('Docker log in') {
@@ -45,7 +45,7 @@ pipeline {
4545
stage(' Docker Push ') {
4646
steps {
4747
echo " Pushing image to Docker"
48-
sh 'docker push javapp:${BUILD_NUMBER}'
48+
sh 'docker push sampleapp:${BUILD_NUMBER}'
4949
post {
5050
success {
5151
echo 'PUSH SUCCESSFUL'

jenkinsfile2

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
pipeline {
2+
agent any
3+
4+
stages {
5+
stage('Compile') {
6+
steps {
7+
echo "compiling stage"
8+
git '[email protected]:maclean23/sample-code-java.git'
9+
sh 'mvn compile'
10+
}
11+
}
12+
13+
stage('Test') {
14+
steps {
15+
echo "testing stage"
16+
sh 'mvn test'
17+
}
18+
}
19+
20+
stage('Package') {
21+
steps {
22+
echo "Packing application"
23+
sh 'mvn package'
24+
}
25+
26+
post {
27+
success {
28+
echo 'Package successful!'
29+
}
30+
}
31+
}
32+
stage('Docker build') {
33+
steps {
34+
echo "building image"
35+
sh 'docker build -t javapp:${BUILD_NUMBER} .'
36+
}
37+
}
38+
stage('Docker log in') {
39+
steps {
40+
echo "Logging into docker"
41+
sh 'docker login -u maclean23'
42+
sh 'dckr_pat_xiWXRPMsc9Xfye1df9n_37Y5RQs'
43+
}
44+
}
45+
stage(' Docker Push ') {
46+
steps {
47+
echo " Pushing image to Docker"
48+
sh 'docker push javapp:${BUILD_NUMBER}'
49+
post {
50+
success {
51+
echo 'PUSH SUCCESSFUL'
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)