Skip to content

Instantly share code, notes, and snippets.

@superzadeh
Last active June 12, 2018 16:55
Show Gist options
  • Save superzadeh/a129a5d8e5c0d40a1b6cc73b8e66bf69 to your computer and use it in GitHub Desktop.
Save superzadeh/a129a5d8e5c0d40a1b6cc73b8e66bf69 to your computer and use it in GitHub Desktop.
Debug config VSCode
FROM node:carbon-slim
EXPOSE 9228
WORKDIR /app
# Install packages
ADD ./package.json ./yarn.lock /app/
RUN cd /app && yarn install
ADD . /app
CMD [ "yarn", "start" ]
{
"version": "0.2.0",
"configurations": [
{
"name": "Docker: attach",
"type": "node",
"request": "attach",
"port": 9228,
"restart": true,
"sourceMaps": false,
"address": "localhost",
"localRoot": "${workspaceRoot}",
"remoteRoot": "/app", # /app is the path where you copy the ${workspaceRoot} inside the container. make sure they match, or debug won't work.
"protocol": "inspector"
}
]
}
{
"name": "yourpackage",
"version": "1.0.0",
"main": "server.js",
"scripts": {
"start": "node --inspect=0.0.0.0:9228 server.js",
"start:watch": "nodemon --inspect=0.0.0.0:9228 server.js",
}
"dependencies: {
}
}
// read https://github.com/Microsoft/vscode-chrome-debug#getting-started to setup Google Chrome correctly
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"webRoot": "${workspaceRoot}",
"userDataDir": false
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"url": "http://localhost:3010",
"webRoot": "${workspaceRoot}"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment