Skip to content

Commit

Permalink
dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
Zolmeister committed Sep 23, 2016
1 parent 511548c commit a2c0c0e
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 26 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:6.6.0

# npm-shrinkwrap.json, package.json
COPY *.json /tmp/
RUN mkdir -p /opt/app && \
cd /opt/app && \
cp /tmp/npm-shrinkwrap.json . && \
cp /tmp/package.json . && \
npm install --production --unsafe-perm --loglevel warn

COPY . /opt/app

WORKDIR /opt/app

CMD ["npm", "start"]
216 changes: 216 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"description": "A narrow fellow in the Pond",
"main": "test-server.js",
"dependencies": {
"express": "~3.4.0"
"express": "^4.14.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node test-server.js"
},
"repository": {
"type": "git",
Expand Down
33 changes: 9 additions & 24 deletions test-server.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@

/**
* Module dependencies.
*/

var express = require('express')
, http = require('http')
, path = require('path');

var app = express();

app.configure(function(){
app.set('port', process.env.PORT || 3000);
app.use(express.logger('dev'));
app.use(app.router);
app.use(express.static(path.join(__dirname, '')));
});

app.configure('development', function(){
app.use(express.errorHandler());
});
var port = process.env.PORT || 3000;

app.all('/', function(req, res){
res.sendfile('index.html');
res.sendFile(path.join(__dirname, 'index.html'));
});

app.get('/ping', function (req, res) {
res.send('pong');
})

app.get('/manifest.webapp', function(req, res){
res.header('Content-Type', 'application/x-web-app-manifest+json');
res.sendfile('manifest.webapp');
});

app.get('/log', function(req, res){
console.log(req.param('l'))
res.end()
})
app.use(express.static(path.join(__dirname, '')));

http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
app.listen(port, function(){
console.log("Express server listening on port " + port);
});

0 comments on commit a2c0c0e

Please sign in to comment.