Add Jenkinsfile and Project
This commit is contained in:
parent
f9f8288f42
commit
bfdcb99493
|
@ -0,0 +1,13 @@
|
||||||
|
# use a node base image
|
||||||
|
FROM node:7-onbuild
|
||||||
|
|
||||||
|
# set maintainer
|
||||||
|
LABEL maintainer "miiro@getintodevops.com"
|
||||||
|
|
||||||
|
# set a health check
|
||||||
|
HEALTHCHECK --interval=5s \
|
||||||
|
--timeout=5s \
|
||||||
|
CMD curl -f http://127.0.0.1:8000 || exit 1
|
||||||
|
|
||||||
|
# tell docker what port to expose
|
||||||
|
EXPOSE 8000
|
|
@ -0,0 +1,25 @@
|
||||||
|
node {
|
||||||
|
def app
|
||||||
|
|
||||||
|
stage('Clone repository') {
|
||||||
|
/* Let's make sure we have the repository cloned to our workspace */
|
||||||
|
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build image') {
|
||||||
|
/* This builds the actual image; synonymous to
|
||||||
|
* docker build on the command line */
|
||||||
|
|
||||||
|
app = docker.build("getintodevops/hellonode")
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Test image') {
|
||||||
|
/* Ideally, we would run a test framework against our image.
|
||||||
|
* For this example, we're using a Volkswagen-type approach ;-) */
|
||||||
|
|
||||||
|
app.inside {
|
||||||
|
sh 'echo "Tests passed"'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// load the http module
|
||||||
|
var http = require('http');
|
||||||
|
|
||||||
|
// configure our HTTP server
|
||||||
|
var server = http.createServer(function (request, response) {
|
||||||
|
response.writeHead(200, {"Content-Type": "text/plain"});
|
||||||
|
response.end("Hello getintodevops.com\n");
|
||||||
|
});
|
||||||
|
|
||||||
|
// listen on localhost:8000
|
||||||
|
server.listen(8000);
|
||||||
|
console.log("Server listening at http://127.0.0.1:8000/");
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "getintodevops-hellonode",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A Hello World HTTP server",
|
||||||
|
"main": "main.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node main.js"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/getintodevops/hellonode/"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"node",
|
||||||
|
"docker",
|
||||||
|
"dockerfile"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue