aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile8
-rwxr-xr-xserver.js8
2 files changed, 14 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index 974e6b0..fd5dd0b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,10 @@
+FROM node:lts-alpine3.13 AS certbuilder
+RUN apk add openssl
+WORKDIR /certs
+RUN openssl req -nodes -new -x509 -subj="/C=US/ST=Denial/L=springfield/O=Dis/CN=localhost" -keyout server.key -out server.cert
+
FROM node:lts-alpine3.13
+COPY --from=certbuilder /certs/ /certs
COPY ./package.* /server/
RUN cd /server && npm install --production
COPY ./css /server/css/
@@ -6,4 +12,4 @@ COPY ./views /server/views/
COPY ./mds /server/mds/
COPY ./server.js /server/
ENTRYPOINT ["/server/server.js"]
-EXPOSE 3000
+EXPOSE 9000
diff --git a/server.js b/server.js
index b51bb52..fb10881 100755
--- a/server.js
+++ b/server.js
@@ -19,6 +19,7 @@ const mit = require("markdown-it")({ html: true })
auto: true,
code: true,
});
+const https = require("https");
const app = express();
app.use(express.static(path.join(__dirname, "css")));
@@ -93,4 +94,9 @@ app.use((err, req, res) => {
return res.status(500).send({ error: err });
});
-app.listen(9000);
+https.createServer({
+ key: fs.readFileSync('/certs/server.key'),
+ cert: fs.readFileSync("/certs/server.cert")
+},app).listen(9000);
+
+// app.listen(9000);