kopia lustrzana https://github.com/linuxserver/docker-documentation
Add D2 diagram support
rodzic
92639f8b7d
commit
bf6739308e
|
@ -0,0 +1,6 @@
|
||||||
|
.cache
|
||||||
|
.github
|
||||||
|
.vscode
|
||||||
|
.editorconfig
|
||||||
|
.markdownlint.yaml
|
||||||
|
Dockerfile
|
|
@ -33,6 +33,15 @@ jobs:
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
- name: Install d2
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/d2
|
||||||
|
D2_VERSION=$(curl -s https://api.github.com/repos/terrastruct/d2/releases/latest | awk '/tag_name/{print $4;exit}' FS='[""]')
|
||||||
|
curl -o \
|
||||||
|
/tmp/d2.tar.gz -L \
|
||||||
|
"https://github.com/terrastruct/d2/releases/download/${D2_VERSION}/d2-${D2_VERSION}-linux-amd64.tar.gz"
|
||||||
|
tar xzf /tmp/d2.tar.gz -C /tmp/d2 --strip-components=1
|
||||||
|
cp /tmp/d2/bin/d2 /usr/local/bin
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r docs/requirements.txt
|
run: pip install -r docs/requirements.txt
|
||||||
- name: Build documentation
|
- name: Build documentation
|
||||||
|
@ -65,6 +74,15 @@ jobs:
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
- name: Install d2
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/d2
|
||||||
|
D2_VERSION=$(curl -s https://api.github.com/repos/terrastruct/d2/releases/latest | awk '/tag_name/{print $4;exit}' FS='[""]')
|
||||||
|
curl -o \
|
||||||
|
/tmp/d2.tar.gz -L \
|
||||||
|
"https://github.com/terrastruct/d2/releases/download/${D2_VERSION}/d2-${D2_VERSION}-linux-amd64.tar.gz"
|
||||||
|
tar xzf /tmp/d2.tar.gz -C /tmp/d2 --strip-components=1
|
||||||
|
cp /tmp/d2/bin/d2 /usr/local/bin
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r docs/requirements.txt
|
run: pip install -r docs/requirements.txt
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM ghcr.io/linuxserver/d2-builder:latest AS d2
|
||||||
|
|
||||||
|
FROM ghcr.io/linuxserver/baseimage-alpine:edge
|
||||||
|
|
||||||
|
# set version label
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG VERSION
|
||||||
|
ARG D2_VERSION
|
||||||
|
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
||||||
|
LABEL maintainer="roxedus"
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
echo "**** install packages ****" && \
|
||||||
|
apk add --no-cache \
|
||||||
|
git \
|
||||||
|
python3 && \
|
||||||
|
mkdir -p /app/mkdocs/docs && \
|
||||||
|
git config --global --add safe.directory /app/mkdocs && \
|
||||||
|
python3 -m venv /lsiopy && \
|
||||||
|
pip install -U --no-cache-dir \
|
||||||
|
pip \
|
||||||
|
wheel
|
||||||
|
|
||||||
|
COPY --from=d2 /usr/local/bin/d2 /usr/local/bin
|
||||||
|
|
||||||
|
COPY docs/requirements.txt /app/mkdocs/docs/requirements.txt
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
pip install -U --no-cache-dir \
|
||||||
|
-r /app/mkdocs/docs/requirements.txt
|
||||||
|
|
||||||
|
COPY . /app/mkdocs/
|
||||||
|
|
||||||
|
WORKDIR /app/mkdocs
|
||||||
|
|
||||||
|
ENTRYPOINT ["catatonit", "--", "mkdocs", "serve"]
|
||||||
|
|
||||||
|
CMD [ "-a", "0.0.0.0:8000" ]
|
|
@ -1,4 +1,5 @@
|
||||||
mkdocs-awesome-pages-plugin==2.9.3
|
mkdocs-awesome-pages-plugin==2.9.3
|
||||||
|
mkdocs-d2-plugin==1.5.0
|
||||||
mkdocs-git-revision-date-localized-plugin==1.3.0
|
mkdocs-git-revision-date-localized-plugin==1.3.0
|
||||||
mkdocs-material==9.5.45
|
mkdocs-material==9.5.45
|
||||||
mkdocs-minify-plugin==0.8.0
|
mkdocs-minify-plugin==0.8.0
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
# Local development
|
||||||
|
|
||||||
|
To speed up the build, you should consider commenting out the `git-revision-date-localized` and `minify` plugin in mkdocs.yml
|
||||||
|
|
||||||
|
## Build image
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker build -t lsio/documentation -f Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run image
|
||||||
|
|
||||||
|
With docs from buildtime
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --rm --name=docs -p 8000:8000 lsio/documentation
|
||||||
|
```
|
||||||
|
|
||||||
|
With docs from runtime
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --rm --name=docs -p 8000:8000 -v $PWD:/app/mkdocs lsio/documentation
|
||||||
|
```
|
||||||
|
|
||||||
|
With watching at runtime
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --rm --name=docs -p 8000:8000 -v $PWD:/app/mkdocs lsio/documentation -a 0.0.0.0:8000 --dirty
|
||||||
|
```
|
||||||
|
|
||||||
|
With custom port
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --rm --name=docs -p 9999:9999 lsio/documentation -a 0.0.0.0:9999
|
||||||
|
```
|
|
@ -75,6 +75,11 @@ markdown_extensions:
|
||||||
permalink: true
|
permalink: true
|
||||||
plugins:
|
plugins:
|
||||||
- awesome-pages
|
- awesome-pages
|
||||||
|
- d2:
|
||||||
|
layout: elk
|
||||||
|
pad: 0
|
||||||
|
theme: 3
|
||||||
|
dark_theme: 200
|
||||||
- git-revision-date-localized:
|
- git-revision-date-localized:
|
||||||
enable_creation_date: true
|
enable_creation_date: true
|
||||||
- minify:
|
- minify:
|
||||||
|
|
Ładowanie…
Reference in New Issue