forked from caprover/caprover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile-captain.debug
26 lines (19 loc) · 1.01 KB
/
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
25
26
FROM node:18
RUN apt-get update && apt-get full-upgrade -yqq && apt-get install build-essential cmake -yqq
RUN apt-get -y install netcat-traditional socat
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV NODE_ENV development
EXPOSE 38000
EXPOSE 3000
ENV ACCEPTED_TERMS=true
# 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.