Skip to content

Instantly share code, notes, and snippets.

@jthomas
Created July 18, 2016 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jthomas/29286b2b1e3ccf0f12609b5894356096 to your computer and use it in GitHub Desktop.
Save jthomas/29286b2b1e3ccf0f12609b5894356096 to your computer and use it in GitHub Desktop.
Running MQTT Server on IBM Containers
FROM node:4
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Bundle app source
COPY . /usr/src/app
EXPOSE 1883
EXPOSE 3000
CMD [ "node", "test.js" ]
var mosca = require('mosca');
var http = require('http');
var express = require('express');
var app = express();
var settings = {
port: 1883,
};
var mqttserver = new mosca.Server(settings);
var httpServer = http.createServer(app);
mqttserver.attachHttpServer(httpServer);
var port = (process.env.VCAP_APP_PORT || 3000);
httpServer.listen(port, function(){
console.log('Express server listening on port ' + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment