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
# Ignore Eleventy's default output directory
_site
# Ignore npm debug logs
npm-debug.log
# Ignore Docker files
Dockerfile
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",
"configurations": [
{
"name": "Docker: Attach to Node",
"type": "docker",
"request": "attach",
"platform": "node",
"containerName": "eleventy"
}
]
}
"version": "0.2.0",
"configurations": [
{
"name": "Docker: Attach to Node",
"type": "node",
"request": "attach",
"port": 9229,
"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",
"tasks": [
"version": "2.0.0",
"tasks": [
{
"label": "docker-compose-up",
"type": "shell",
"command": "docker-compose up --build",
"isBackground": true,
"problemMatcher": [
{
"label": "docker-build",
"type": "shell",
"command": "docker build -t eleventy .",
"problemMatcher": []
},
{
"label": "docker-run",
"type": "shell",
"command": "docker run -d --name eleventy -p 8080:8080 eleventy",
"problemMatcher": []
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"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 ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "npx", "@11ty/eleventy", "--serve" ]
EXPOSE 8080 9229
CMD [ "npm", "start" ]

View File

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

View File

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