Skip to content

Instantly share code, notes, and snippets.

@atd-schubert
Created February 20, 2019 08:10
Show Gist options
  • Save atd-schubert/920b760835b7a3809d472a31448de9a6 to your computer and use it in GitHub Desktop.
Save atd-schubert/920b760835b7a3809d472a31448de9a6 to your computer and use it in GitHub Desktop.
InteliJ with connected debugger on a TypeScript Project in Docker
version: "3"
services:
debugger:
build: ./
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./src:/opt/debugger/src
- ./lib:/opt/debugger/lib
command: "node --inspect-brk=0.0.0.0:9229 -r source-map-support/register /opt/debugger/lib/index.js"
FROM node
COPY ./package.json ./yarn.lock ./tsconfig.json /opt/debugger/
WORKDIR /opt/debugger
RUN set -x \
&& yarn
COPY ./ /opt/debugger
RUN set -x \
&& yarn transpile
<configuration name="NPM debug" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="docker:debug" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2">
<option name="NpmBeforeRunTask" enabled="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="transpile" />
</scripts>
<node-interpreter value="project" />
<envs />
</option>
</method>
</configuration>
{
"name": "spike-debugger-in-docker",
"version": "1.0.0",
"description": "",
"main": "lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"transpile": "tsc",
"docker:debug": "docker-compose run --rm -p 127.0.0.1:8080:8080 -p 127.0.0.1:`echo $NODE_DEBUG_OPTION | cut -d= -f 2`:9229 debugger",
"docker:build": "docker-compose build"
},
"author": "",
"license": "ISC",
"devDependencies": {
"source-map-support": "^0.5.10",
"ts-node": "^8.0.2",
"typescript": "^3.3.3"
},
"dependencies": {
"@types/express": "^4.16.1",
"express": "^4.16.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment