Skip to content

Instantly share code, notes, and snippets.

@yaroslavTsebro
Last active August 1, 2023 05:15
Show Gist options
  • Select an option

  • Save yaroslavTsebro/2922c4ec9542053e8c220892b46d8bb3 to your computer and use it in GitHub Desktop.

Select an option

Save yaroslavTsebro/2922c4ec9542053e8c220892b46d8bb3 to your computer and use it in GitHub Desktop.
ts-node nodemon docker debug-mode
version: "3.7"
services:
backend:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
- "9229:9229"
environment:
NODE_ENV: "production"
DB_USER: user
DB_PASSWORD: password
DB_HOST: "mongodb"
DB_PORT: 27017
DB_NAME: mydb1
LOGS_PATH: "./data/logs/pino-logger.log"
volumes:
- ./src:/usr/app/src
FROM node:18
WORKDIR /usr/app
RUN npm install nodemon bcrypt -g
COPY package*.json ./
RUN npm install --force
COPY . ./
EXPOSE 3000
CMD [ "npm", "run", "start-dev" ]
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Node: Nodemon",
"restart": true,
"sourceMaps": true,
"protocol": "inspector",
"address": "127.0.0.1",
"port": 9229,
"localRoot": "${workspaceRoot}",
"remoteRoot": "/usr/app",
},
]
}
{
"watch": ["src"],
"ext": ".ts,.js",
"ignore": [],
"exec": "ts-node --files ./src/app.ts --polling"
}
src
...
...
app.ts
server.ts
Dockerfile.dev
docker-compose.dev.yaml
"scripts": {
"start-dev": "nodemon -L --inspect-brk=0.0.0.0:9229 --signal SIGINT --nolazy src/app.ts",
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment