Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerpackage #129

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM maven:3.6.3-jdk-11-slim as build
WORKDIR /opt/demo
COPY . /opt/demo
RUN mvn package -D skipTests
FROM tomcat as run
WORKDIR /usr/local/tomcat
COPY --from=build /opt/demo/target/sysfoo.war webapps/ROOT.war
75 changes: 75 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
pipeline {
agent any
stages {
stage('build') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
steps {
echo 'compile maven app'
sh 'mvn compile'
}
}

stage('test') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
steps {
echo 'test maven app'
sh 'mvn clean test'
}
}

stage('package') {
agent {
docker {
image 'maven:3.6.3-jdk-11-slim'
}

}
steps {
echo 'package maven app'
sh 'mvn package -DskipTests'
archiveArtifacts 'target/*.war'
}
}

stage('Docker BnP') {
agent any
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') {
def dockerImage = docker.build("rapoplai/sysfoo:v${env.BUILD_ID}", "./")
dockerImage.push()
dockerImage.push("latest")
dockerImage.push("dev")
}
}

}
}

stage('Deploy to Dev') {
when {
beforeAgent true
branch 'master'
}
agent any
steps {
echo 'Deploying to Dev Environment with Docker Compose'
sh 'docker-compose up -d'
}
}

}
tools {
maven 'Maven 3.6.3'
}
}
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.8"
services:
sysfoo:
image: rapoplai/sysfoo:latest
ports:
- 8888:8080
4 changes: 4 additions & 0 deletions test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Example App
=========

This is a sample app.