diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3483384 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM node:16.20.2-alpine AS builder +RUN apk add --no-cache libc6-compat +RUN npm i -g pnpm@8.2.0 + +# 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 pnpm@8.2.0 +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" ] \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index a10e4ab..52c9265 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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();