How to RUN a NodeJS application in Docker


FROM node:14-alpine3.15 


RUN chown -R node /app

USER root

COPY package.json .

RUN npm install 

COPY . . 

EXPOSE 8080 

CMD [ "node", "server.js" ]


const express = require('express');

const app = new express(); 

const port = process.env.PORT || 8080 ; 

app.get('/', (req, res)=>{
    res.send('AWS With Atiq');

app.listen(port, ()=>{
    console.log('app started');

Leave a Comment

Your email address will not be published. Required fields are marked *