forked from caprover/caprover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile-captain.debug
24 lines (18 loc) · 993 Bytes
/
dockerfile-captain.debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM node:14
RUN apt-get update && apt-get full-upgrade -yqq && apt-get install build-essential cmake -yqq
RUN apt-get -y install netcat socat
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV NODE_ENV development
EXPOSE 38000
EXPOSE 3000
# I don't know why, but for some reason this port
# forwarding is necessary for NodeJs debugger to be able to attach!!
RUN echo "(socat -v tcp-listen:38000,reuseaddr,fork tcp:localhost:38213) & \n node --inspect-brk=38213 /usr/src/app/built/server.js" > /usr/run-brk.sh
RUN echo "(socat -v tcp-listen:38000,reuseaddr,fork tcp:localhost:38213) & \n node --inspect=38213 /usr/src/app/built/server.js" > /usr/run.sh
RUN chmod +x /usr/run.sh
RUN chmod +x /usr/run-brk.sh
CMD ["/bin/bash" , "-c" , "/usr/run.sh" ]
### Debugging only works with chrome tools. Copy and past URL printed when service starts (starts with chrome-dev)
### Just replace the port with 38000
### change --inspect to --inspect-brk to make node wait until debug is attached.