Fixed Dockerfile
This commit is contained in:
parent
cc1e3e8379
commit
e65dc094a0
@ -12,8 +12,7 @@ RUN npm pack stackedit@$V4_VERSION \
|
|||||||
|
|
||||||
WORKDIR /opt/stackedit
|
WORKDIR /opt/stackedit
|
||||||
|
|
||||||
COPY package.json /opt/stackedit/
|
COPY package*json /opt/stackedit/
|
||||||
COPY package-lock.lock /opt/stackedit/
|
|
||||||
COPY gulpfile.js /opt/stackedit/
|
COPY gulpfile.js /opt/stackedit/
|
||||||
RUN npm install \
|
RUN npm install \
|
||||||
&& npm cache clean --force
|
&& npm cache clean --force
|
||||||
|
17
index.js
17
index.js
@ -7,28 +7,13 @@ Object.keys(env).forEach((key) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const https = require('https');
|
|
||||||
const path = require('path');
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
require('./server')(app, process.env.SERVE_V4);
|
require('./server')(app, process.env.SERVE_V4);
|
||||||
|
|
||||||
let port = parseInt(process.env.PORT || 8080, 10);
|
const port = parseInt(process.env.PORT || 8080, 10);
|
||||||
if (port === 443) {
|
|
||||||
const credentials = {
|
|
||||||
key: fs.readFileSync(path.join(__dirname, 'ssl.key'), 'utf8'),
|
|
||||||
cert: fs.readFileSync(path.join(__dirname, 'ssl.crt'), 'utf8'),
|
|
||||||
ca: fs.readFileSync(path.join(__dirname, 'ssl.ca'), 'utf8').split('\n\n'),
|
|
||||||
};
|
|
||||||
const httpsServer = https.createServer(credentials, app);
|
|
||||||
httpsServer.listen(port, null, () => {
|
|
||||||
console.log('HTTPS server started: https://localhost');
|
|
||||||
});
|
|
||||||
port = 80;
|
|
||||||
}
|
|
||||||
const httpServer = http.createServer(app);
|
const httpServer = http.createServer(app);
|
||||||
httpServer.listen(port, null, () => {
|
httpServer.listen(port, null, () => {
|
||||||
console.log(`HTTP server started: http://localhost:${port}`);
|
console.log(`HTTP server started: http://localhost:${port}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user