Move node commands to docker container
This commit is contained in:
43
Jenkinsfile
vendored
43
Jenkinsfile
vendored
@@ -3,29 +3,25 @@ node {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage ("Dependencies") {
|
||||
sh "npm ci"
|
||||
}
|
||||
|
||||
stage ("Build Gatsby") {
|
||||
environment {
|
||||
GATSBY_FIREBASE_API_KEY = credentials('FIREBASE_API_KEY')
|
||||
GATSBY_AUTH_DOMAIN = "spencassemble-sol-journal.firebaseapp.com"
|
||||
GATSBY_DATABASE_URL = "https://spencassemble-sol-journal.firebaseio.com"
|
||||
GATSBY_PROJECT_ID = "spencassemble-sol-journal"
|
||||
GATSBY_STORAGE_BUCKET = "spencassemble-sol-journal.appspot.com"
|
||||
GATSBY_MESSAGING_SENDER_ID = "299522647169"
|
||||
GATSBY_APP_ID = "1:299522647169:web:fc74af44747fd7cef79980"
|
||||
}
|
||||
steps {
|
||||
sh "npm run build"
|
||||
}
|
||||
}
|
||||
|
||||
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"'
|
||||
docker.image("node:fermium-alpine").withRun("") {
|
||||
stage ("Dependencies") {
|
||||
sh "npm ci"
|
||||
}
|
||||
|
||||
stage ("Build Gatsby") {
|
||||
environment {
|
||||
GATSBY_FIREBASE_API_KEY = credentials('FIREBASE_API_KEY')
|
||||
GATSBY_AUTH_DOMAIN = "spencassemble-sol-journal.firebaseapp.com"
|
||||
GATSBY_DATABASE_URL = "https://spencassemble-sol-journal.firebaseio.com"
|
||||
GATSBY_PROJECT_ID = "spencassemble-sol-journal"
|
||||
GATSBY_STORAGE_BUCKET = "spencassemble-sol-journal.appspot.com"
|
||||
GATSBY_MESSAGING_SENDER_ID = "299522647169"
|
||||
GATSBY_APP_ID = "1:299522647169:web:fc74af44747fd7cef79980"
|
||||
}
|
||||
steps {
|
||||
sh "npm run build"
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Build Container") {
|
||||
@@ -33,6 +29,9 @@ node {
|
||||
}
|
||||
|
||||
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