diff --git a/.vscode/launch.json b/.vscode/launch.json index ce7bf3a..c95c1c9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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", "configurations": [ { @@ -46,6 +43,17 @@ "port": 5678, "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 + } ] -} \ No newline at end of file +} diff --git a/docker-compose.yaml b/docker-compose.yaml index 15ff12b..b5fef21 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -30,7 +30,7 @@ services: image: aimvector/nodejs:1.0.0 build: context: ./nodejs - target: prod + target: debug #working_dir: /work #comment out for build.target:prod #entrypoint: /bin/sh #comment out for build.target:prod #stdin_open: true #comment out for build.target:prod @@ -39,6 +39,7 @@ services: - ./nodejs/src/:/work ports: - 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 container_name: python image: aimvector/python:1.0.0 diff --git a/nodejs/dockerfile b/nodejs/dockerfile index 56f67bd..0a37b6a 100644 --- a/nodejs/dockerfile +++ b/nodejs/dockerfile @@ -1,11 +1,18 @@ -FROM node:12.4.0-alpine as dev - +FROM node:12.4.0-alpine as debug WORKDIR /work/ COPY ./src/package.json /work/package.json RUN npm install +RUN npm install -g nodemon 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 \ No newline at end of file