Skip to content

Commit ace8aa4

Browse files
authored
Merge pull request #26 from juliakm/users/jukullam/docker-updates
Updating express app and Dockerfile
2 parents 3dcbb46 + fcab13c commit ace8aa4

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

app/Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
FROM node:8
1+
# syntax=docker/dockerfile:1
22

3-
WORKDIR /usr/src/app
3+
FROM node:12.18.1
4+
ENV NODE_ENV=production
45

5-
COPY package*.json ./
6-
RUN npm ci --only=production
6+
WORKDIR /app
7+
8+
COPY ["package.json", "package-lock.json*", "./"]
9+
10+
RUN npm install --production
711

812
COPY . .
913

10-
EXPOSE 8080
11-
CMD [ "npm", "start" ]
14+
CMD [ "node", "server.js" ]

app/server.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
'use strict';
1+
const express = require('express')
2+
const app = express()
3+
const port = 3000
24

3-
const express = require('express');
4-
5-
const PORT = 8080;
6-
const HOST = '0.0.0.0';
7-
8-
const app = express();
95
app.get('/', (req, res) => {
10-
res.send('Hello world\n');
11-
});
6+
res.send('Hello World!')
7+
})
128

13-
app.listen(PORT, HOST);
14-
console.log(`Running on http://${HOST}:${PORT}`);
9+
app.listen(port, () => {
10+
console.log(`Example app listening on port ${port}`)
11+
})

0 commit comments

Comments
 (0)