Created
October 9, 2018 03:29
-
-
Save caroso1222/e2fcd6fd274d82d91334ebe6e4ce0586 to your computer and use it in GitHub Desktop.
Jenkins pipeline sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 root@my.server.ip \"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