update Docker and VS Code configurations for improved debugging
This commit is contained in:
@@ -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
4
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
_site/
|
||||
node_modules
|
||||
_site
|
||||
.DS_Store
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
42
.vscode/tasks.json
vendored
42
.vscode/tasks.json
vendored
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
@@ -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" ]
|
@@ -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
|
||||
|
15
package.json
15
package.json
@@ -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"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user