Skip to content

Commit

Permalink
feat: docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
npv2k1 committed Nov 5, 2023
1 parent 7eb9606 commit e191c73
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:16.20.2-alpine AS builder
RUN apk add --no-cache libc6-compat
RUN npm i -g [email protected]

# Create app directory
WORKDIR /app

# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
RUN pnpm install

COPY . .
RUN npm run build

FROM node:16.20.2-alpine
RUN apk add --no-cache libc6-compat
RUN npm i -g [email protected]
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist


EXPOSE 4000
CMD [ "npm", "run", "start" ]
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
var http = require('http');



async function bootstrap() {
console.log('Hello');
console.log('Starting server...');
//create a server object:
http
.createServer(function (req, res) {
res.write('Hello World!'); //write a response to the client
res.end(); //end the response
})
.listen(8080); //the server object listens on port 8080
}
bootstrap();

0 comments on commit e191c73

Please sign in to comment.