add nodejs debugger

This commit is contained in:
marcel-dempers 2020-03-29 22:36:26 +11:00
parent 26b1cc8d2d
commit 772ef7e985
3 changed files with 25 additions and 9 deletions

18
.vscode/launch.json vendored
View File

@ -1,7 +1,4 @@
{ {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
@ -46,6 +43,17 @@
"port": 5678, "port": 5678,
"host": "127.0.0.1" "host": "127.0.0.1"
}, },
{
"name": "Docker: Attach to Node",
"type": "node",
"request": "attach",
"remoteRoot": "/work/",
"port": 9229,
"address": "localhost",
"localRoot": "${workspaceFolder}/nodejs/src/",
"protocol": "inspector",
"restart": true
}
] ]
} }

View File

@ -30,7 +30,7 @@ services:
image: aimvector/nodejs:1.0.0 image: aimvector/nodejs:1.0.0
build: build:
context: ./nodejs context: ./nodejs
target: prod target: debug
#working_dir: /work #comment out for build.target:prod #working_dir: /work #comment out for build.target:prod
#entrypoint: /bin/sh #comment out for build.target:prod #entrypoint: /bin/sh #comment out for build.target:prod
#stdin_open: true #comment out for build.target:prod #stdin_open: true #comment out for build.target:prod
@ -39,6 +39,7 @@ services:
- ./nodejs/src/:/work - ./nodejs/src/:/work
ports: ports:
- 5002:5000 - 5002:5000
- 9229:9229 #debug port
python: #docker run -it -v ${PWD}:/work -w /work -p 5003:5000 aimvector/python:1.0.0 /bin/sh python: #docker run -it -v ${PWD}:/work -w /work -p 5003:5000 aimvector/python:1.0.0 /bin/sh
container_name: python container_name: python
image: aimvector/python:1.0.0 image: aimvector/python:1.0.0

View File

@ -1,11 +1,18 @@
FROM node:12.4.0-alpine as dev FROM node:12.4.0-alpine as debug
WORKDIR /work/ WORKDIR /work/
COPY ./src/package.json /work/package.json COPY ./src/package.json /work/package.json
RUN npm install RUN npm install
RUN npm install -g nodemon
COPY ./src/ /work/ COPY ./src/ /work/
CMD node . CMD nodemon --inspect=0.0.0.0 server.js
FROM node:12.4.0-alpine as prod
COPY ./src/package.json /work/package.json
RUN npm install
CMD node server.js