Skip to content

Commit e191c73

Browse files
committed
feat: docker file
1 parent 7eb9606 commit e191c73

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

Diff for: Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:16.20.2-alpine AS builder
2+
RUN apk add --no-cache libc6-compat
3+
RUN npm i -g [email protected]
4+
5+
# Create app directory
6+
WORKDIR /app
7+
8+
# A wildcard is used to ensure both package.json AND package-lock.json are copied
9+
COPY package*.json ./
10+
RUN pnpm install
11+
12+
COPY . .
13+
RUN npm run build
14+
15+
FROM node:16.20.2-alpine
16+
RUN apk add --no-cache libc6-compat
17+
RUN npm i -g [email protected]
18+
WORKDIR /app
19+
COPY --from=builder /app/node_modules ./node_modules
20+
COPY --from=builder /app/package*.json ./
21+
COPY --from=builder /app/dist ./dist
22+
23+
24+
EXPOSE 4000
25+
CMD [ "npm", "run", "start" ]

Diff for: src/index.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
var http = require('http');
2+
3+
4+
15
async function bootstrap() {
2-
console.log('Hello');
6+
console.log('Starting server...');
7+
//create a server object:
8+
http
9+
.createServer(function (req, res) {
10+
res.write('Hello World!'); //write a response to the client
11+
res.end(); //end the response
12+
})
13+
.listen(8080); //the server object listens on port 8080
314
}
415
bootstrap();

0 commit comments

Comments
 (0)