Move node commands to docker container
This commit is contained in:
11
Jenkinsfile
vendored
11
Jenkinsfile
vendored
@@ -3,6 +3,8 @@ node {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
docker.withServer("ssh://rancher@192.168.1.116") {
|
||||
docker.image("node:fermium-alpine").withRun("") {
|
||||
stage ("Dependencies") {
|
||||
sh "npm ci"
|
||||
}
|
||||
@@ -22,17 +24,14 @@ node {
|
||||
}
|
||||
}
|
||||
|
||||
docker.withServer("ssh://rancher@192.168.1.116") {
|
||||
docker.image("docker").withRun("") {
|
||||
withCredentials([usernamePassword(credentialsId: "DockerHub", usernameVariable: "DOCKERUSER", passwordVariable: "DOCKERPASS")]) {
|
||||
sh 'docker login -u "$DOCKERUSER" -p "$DOCKERPASS"'
|
||||
}
|
||||
|
||||
stage ("Build Container") {
|
||||
sh "docker image build -t spencerpincott/sol-journal:1.${env.BUILD_NUMBER} ."
|
||||
}
|
||||
|
||||
stage ("Publish Container") {
|
||||
withCredentials([usernamePassword(credentialsId: "DockerHub", usernameVariable: "DOCKERUSER", passwordVariable: "DOCKERPASS")]) {
|
||||
sh 'docker login -u "$DOCKERUSER" -p "$DOCKERPASS"'
|
||||
}
|
||||
sh "docker image push spencerpincott/sol-journal:1.${env.BUILD_NUMBER}"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user