Public Access
1
0

update Docker and VS Code configurations for improved debugging

This commit is contained in:
2025-08-11 10:50:12 -04:00
parent 6c26b77fb5
commit 103080ba1b
7 changed files with 61 additions and 52 deletions

View File

@@ -1,12 +1,11 @@
# Ignore the node_modules directory, as it will be installed inside the container
node_modules node_modules
# Ignore Eleventy's default output directory
_site _site
# Ignore npm debug logs
npm-debug.log npm-debug.log
# Ignore Docker files
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml
.git
.gitignore

4
.gitignore vendored
View File

@@ -1 +1,3 @@
_site/ node_modules
_site
.DS_Store

26
.vscode/launch.json vendored
View File

@@ -1,12 +1,16 @@
{ {
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Docker: Attach to Node", "name": "Docker: Attach to Node",
"type": "docker", "type": "node",
"request": "attach", "request": "attach",
"platform": "node", "port": 9229,
"containerName": "eleventy" "address": "localhost",
} "localRoot": "${workspaceFolder}",
] "remoteRoot": "/usr/src/app",
} "restart": true,
"preLaunchTask": "docker-compose-up"
}
]
}

44
.vscode/tasks.json vendored
View File

@@ -1,17 +1,33 @@
{ {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{
"label": "docker-compose-up",
"type": "shell",
"command": "docker-compose up --build",
"isBackground": true,
"problemMatcher": [
{ {
"label": "docker-build", "pattern": [
"type": "shell", {
"command": "docker build -t eleventy .", "regexp": ".",
"problemMatcher": [] "file": 1,
}, "location": 2,
{ "message": 3
"label": "docker-run", }
"type": "shell", ],
"command": "docker run -d --name eleventy -p 8080:8080 eleventy", "background": {
"problemMatcher": [] "activeOnStart": true,
"beginsPattern": "Attaching to",
"endsPattern": "Server at"
}
} }
] ]
} },
{
"label": "docker-compose-down",
"type": "shell",
"command": "docker-compose down"
}
]
}

View File

@@ -4,5 +4,5 @@ WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
COPY . . COPY . .
EXPOSE 8080 EXPOSE 8080 9229
CMD [ "npx", "@11ty/eleventy", "--serve" ] CMD [ "npm", "start" ]

View File

@@ -1,19 +1,10 @@
services: services:
eleventy: eleventy:
# Build the Docker image from the Dockerfile in the current directory
build: . build: .
# Name the container for easier reference
container_name: eleventy_dev container_name: eleventy_dev
# Map port 8080 on the host to port 8080 in the container
ports: ports:
- 8080:8080 - 8080:8080
# Mount the current directory on the host to /app in the container - 9229:9229
# This allows for live-reloading as you edit your files locally
volumes: volumes:
- .:/app - .:/app
- /app/node_modules - /app/node_modules
labels:
diun.enable: false
homepage.group: Tools
homepage.name: Eleventy
homepage.icon: eleventy

View File

@@ -1,18 +1,15 @@
{ {
"name": "eleventy", "name": "eleventy-docker-debug",
"version": "1.0.0", "version": "1.0.0",
"description": "A basic Eleventy project.", "description": "An Eleventy project with Docker and VS Code debugging.",
"scripts": { "scripts": {
"start": "npx @11ty/eleventy --serve", "start": "eleventy --serve --watch",
"build": "npx @11ty/eleventy" "debug": "node --inspect=0.0.0.0:9229 ./node_modules/.bin/eleventy --serve --watch"
}, },
"keywords": [ "keywords": [],
"eleventy",
"static-site-generator"
],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "dependencies": {
"@11ty/eleventy": "^2.0.1" "@11ty/eleventy": "^2.0.1"
} }
} }