diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..211cc72 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,11 @@ +FROM node:21-alpine3.19 +RUN apk add --no-cache \ + git \ + nano\ + openssh \ + py3-pip +ENV USER node +USER $USER +# python packages (as mkdocs) are installed in the user's home directory +# but we need them to be accessible from $PATH +ENV PATH="$PATH:/home/$USER/.local/bin" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..d96d265 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +{ + "name": "Pi-hole doc devcontainer", + "dockerFile": "Dockerfile", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sh .devcontainer/post-create.sh", + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + "settings": {}, + "extensions": [ + "eamodio.gitlens", + "EditorConfig.EditorConfig", + "github.vscode-github-actions", + "DavidAnson.vscode-markdownlint" + + ] + } + }, + "containerEnv": { + "GIT_EDITOR": "nano" + }, + "mounts": [ + "type=bind,source=/home/${localEnv:USER}/.ssh,target=/home/node/.ssh,readonly" + ], + "forwardPorts": [8000] +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..44c9b6b --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,3 @@ +#! /bin/sh +npm install +pip3 install -r requirements.txt --break-system-packages --no-warn-script-location diff --git a/package-lock.json b/package-lock.json index 8fc6096..94c7ebb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "CC-BY-SA-4.0", "devDependencies": { "linkinator": "^6.0.4", - "markdownlint-cli2": "0.12.1" + "markdownlint-cli2": "^0.12.0" } }, "node_modules/@isaacs/cliui": { diff --git a/package.json b/package.json index 2fc133b..c597d3a 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,11 @@ "build": "mkdocs build --clean", "markdownlint": "markdownlint-cli2 \"**/*.md\" \"!**/node_modules/**\"", "linkinator": "npm run build && linkinator site --recurse --silent --skip \"^(?!http://localhost)\"", - "test": "npm run markdownlint && npm run linkinator" + "test": "npm run markdownlint && npm run linkinator", + "serve": "mkdocs serve --dev-addr 0.0.0.0:8000" }, "devDependencies": { "linkinator": "^6.0.4", - "markdownlint-cli2": "0.12.1" + "markdownlint-cli2": "^0.12.0" } }