Skip to content

Instantly share code, notes, and snippets.

@lammichael
Last active February 1, 2022 20:48
Show Gist options
  • Save lammichael/223a252566035e28ad6cc9ae57807607 to your computer and use it in GitHub Desktop.
Save lammichael/223a252566035e28ad6cc9ae57807607 to your computer and use it in GitHub Desktop.
Debugging a parcel app, running in Docker, in VS Code
version: "3.7"
services:
serve:
build:
context: .
volumes:
- .:/app/
ports:
- 1234:1234
- 1235:1235
environment:
- CHOKIDAR_USEPOLLING=1
FROM node:10.15.3-alpine
WORKDIR /app
# In package.json I define the serve script as
# "parcel src/index.html --hmr-port 1235"
ENTRYPOINT ["npm", "run", "serve"]
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:1234",
"webRoot": "${workspaceFolder}/src",
"preLaunchTask": "Docker Compose: up",
"postDebugTask": "Docker Compose: down",
"skipFiles": [
"node_modules"
],
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "Docker Compose: up",
"command": "docker-compose",
"args": [
"up",
"serve"
],
"isBackground": true,
"problemMatcher": {
"fileLocation": "absolute",
"owner": "docker-compose",
"background": {
"activeOnStart": true,
"beginsPattern": ".*",
"endsPattern": "Built"
},
"pattern": {
"regexp": "",
}
}
},
{
"label": "Docker Compose: down",
"command": "docker-compose",
"args": [
"down",
"--timeout",
"1"
]
}
]
}
@alexanderchan
Copy link

@lammichael This looks great, thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment