0

someone help me begging why my nodemon doesn't restart itself in my Dockerfile is there something wrong?

This is my Package.json

{
  "name": "docker-node-app-1",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "dev": "nodemon -L index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2"
  },
  "devDependencies": {
    "nodemon": "^2.0.20"
  }
}

This my Dockerfile

FROM node
WORKDIR /app
COPY package.json .
RUN npm install
COPY . ./
EXPOSE 3000
CMD ["npm", "run", "dev"]

And this my server.js

const express = require('express');
const app = express();

app.get("/", (req, res) => { 
    res.send("<h2> Hallo Dunia </h2>")
});

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

app.listen(port, () => console.log(`Listening on port ${port}`)); 

0 Answers0