Skip to content

Commit

Permalink
Merge pull request #979 from pi-hole/devcontainer
Browse files Browse the repository at this point in the history
Add devcontainer
  • Loading branch information
yubiuser committed Feb 23, 2024
2 parents 2fa3c61 + 0469094 commit b332cd4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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]
}
3 changes: 3 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh
npm install
pip3 install -r requirements.txt --break-system-packages --no-warn-script-location
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit b332cd4

Please sign in to comment.