Skip to content

Commit

Permalink
docker nodejs debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
marcel-dempers committed Apr 23, 2020
1 parent a6ea337 commit ac3aed8
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 411 deletions.
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@
"host": "127.0.0.1"
},
{

"name": "Docker: Attach to Node",
"type": "node",
"request": "attach",
"remoteRoot": "/work/",
"remoteRoot": "/work/src/",
"port": 9229,
"address": "localhost",
"localRoot": "${workspaceFolder}/nodejs/src/",
Expand Down
29 changes: 15 additions & 14 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,34 @@ services:
- 2345:2345
security_opt:
- "seccomp:unconfined"
nodejs: #docker run -it -v ${PWD}:/work -w /work -p 5002:5000 aimvector/nodejs:1.0.0 /bin/sh
container_name: nodejs
image: aimvector/nodejs:1.0.0
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
build:
context: ./nodejs
context: ./python
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
#tty: true #comment out for build.target:prod
volumes:
- ./nodejs/src/:/work
- ./python/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
- 5003:5000
- 5678:5678
nodejs: #docker run -it -v ${PWD}:/work -w /work -p 5002:5000 aimvector/nodejs:1.0.0 /bin/sh
container_name: nodejs
image: aimvector/nodejs:1.0.0
build:
context: ./python
context: ./nodejs
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
#tty: true #comment out for build.target:prod
volumes:
- ./python/src/:/work
- ./nodejs/src/:/work/src/
ports:
- 5003:5000
- 5678:5678
- 5002:5000
- 9229:9229 #debug port

15 changes: 0 additions & 15 deletions nodejs/deployment/service copy.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions nodejs/deployment/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: example-service
labels:
app: example-app
spec:
type: LoadBalancer
selector:
app: example-app
ports:
- protocol: TCP
name: http
port: 80
targetPort: 5000
4 changes: 2 additions & 2 deletions nodejs/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ COPY ./src/package.json /work/package.json
RUN npm install
RUN npm install -g nodemon

COPY ./src/ /work/
COPY ./src/ /work/src/

CMD nodemon --inspect=0.0.0.0 server.js
ENTRYPOINT [ "nodemon","--inspect=0.0.0.0","./src/server.js" ]

FROM node:12.4.0-alpine as prod

Expand Down
Loading

0 comments on commit ac3aed8

Please sign in to comment.