-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Kerr
committed
Aug 10, 2018
1 parent
103cc9d
commit 0d7483c
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
npm-debug.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:8 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
CMD [ "npm", "start" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
podTemplate(label: "default", cloud: "local-cluster") { | ||
node("default") { | ||
def buildName = "${env.BRANCH_NAME}-${env.BUILD_NUMBER}" | ||
def projectID = "quixotic-strand-159502" | ||
def imageTag = "gcr.io/${projectID}/cluso:${env.BRANCH_NAME}.${env.BUILD_NUMBER}" | ||
def slackBuildUrl = "<${env.BUILD_URL}|looky-desktop: ${buildName}>" | ||
|
||
try { | ||
stage("checkout source") { | ||
slackSend message: "Building...\n${slackBuildUrl}" | ||
checkout scm | ||
} | ||
|
||
stage("build") { | ||
sh "docker build -t ${imageTag} ." | ||
} | ||
|
||
stage("unit tests") { | ||
sh "docker run --rm -i ${imageTag} /bin/sh -c \"npm test\"" | ||
} | ||
|
||
stage("push image") { | ||
sh "gcloud docker -- push ${imageTag}" | ||
|
||
if (env.BRANCH_NAME == "master") { | ||
def latestTag = "gcr.io/${projectID}/cluso:latest" | ||
sh("docker tag ${imageTag} ${latestTag}") | ||
sh("gcloud docker -- push ${latestTag}") | ||
} | ||
|
||
} | ||
|
||
stage("notify") { | ||
slackSend color: "good", message: "Build Succeeded!\n${slackBuildUrl}" | ||
} | ||
|
||
} | ||
|
||
catch (error) { | ||
slackSend color: "danger", message: "Build Failed!\n${slackBuildUrl}" | ||
throw error | ||
} | ||
} | ||
} |