Skip to content

Instantly share code, notes, and snippets.

@kamilziajka
Created June 24, 2016 10:59
Show Gist options
  • Save kamilziajka/7d3ac3dcec7d3da19edda9654bd85973 to your computer and use it in GitHub Desktop.
Save kamilziajka/7d3ac3dcec7d3da19edda9654bd85973 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
FROM node:6
ADD server.js /server.js
ADD cert.pem /cert.pem
ADD key.pem /key.pem
CMD ["node", "/server.js"]
EXPOSE 8080
const {createServer} = require('https');
const {readFileSync} = require('fs');
const port = 8080;
const host = '0.0.0.0';
const options = {
key: readFileSync('key.pem'),
cert: readFileSync('cert.pem')
};
const server = createServer(options, (req, res) => {
res.end('hello https');
});
server.listen(
port,
host,
() => console.log('server up')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment