Skip to content

Instantly share code, notes, and snippets.

@caroso1222
Created October 9, 2018 03:29
Show Gist options
  • Save caroso1222/e2fcd6fd274d82d91334ebe6e4ce0586 to your computer and use it in GitHub Desktop.
Save caroso1222/e2fcd6fd274d82d91334ebe6e4ce0586 to your computer and use it in GitHub Desktop.
Jenkins pipeline sample
#!/usr/bin/env groovy
node {
def app
stage("Clone") {
git 'https://github.com/caroso1222/ast-viewer.git'
}
stage("Build") {
app = docker.build("caroso1222/ts-ast-viewer")
}
stage("Push") {
docker.withRegistry("https://registry.hub.docker.com", "docker-hub-credentials") {
app.push("${env.BUILD_ID}")
app.push("latest")
}
}
stage("Deploy") {
sh "ssh [email protected] \"docker stop ast_0 && \
docker rm ast_0 && \
docker pull caroso1222/ts-ast-viewer:latest && \
docker run -d --name=ast_0 -p 8080:80 caroso1222/ts-ast-viewer:latest\""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment