Compare commits
3 Commits
9fcc601730
...
39064633ed
Author | SHA1 | Date | |
---|---|---|---|
39064633ed | |||
e769a9dd70 | |||
96a7cbe954 |
94
.gitea/workflows/build-and-push-mkdocs-docker-image.yml
Normal file
94
.gitea/workflows/build-and-push-mkdocs-docker-image.yml
Normal file
@ -0,0 +1,94 @@
|
||||
name: Build and Push MkDocs Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
- 'user/**'
|
||||
- 'admin/**'
|
||||
- '.gitea/workflows/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: cth-ubuntu-latest
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.REGISTRY }}
|
||||
IMAGE: ${{ vars.IMAGE }}
|
||||
IMAGE_NAME: ${{ env.REGISTRY }}/${{ IMAGE }}:${{ github.sha }}
|
||||
KUBE_CA: ${{ vars.KUBE_CA }}
|
||||
KUBE_SERVER: ${{ vars.KUBE_SERVER }}
|
||||
REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME }}
|
||||
NAMESPACE: ${{ vars.NAMESPACE }}
|
||||
DEPLOYMENT_NAME: ${{ vars.DEPLOYMENT_NAME }}
|
||||
CONTAINER: ${{ vars.CONTAINER }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker registry
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
id: build-push
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: documentation.Dockerfile
|
||||
push: true
|
||||
tags: '${{ env.IMAGE_NAME }}'
|
||||
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
curl -LO "https://dl.k8s.io/release/v1.31.0/bin/linux/amd64/kubectl"
|
||||
chmod +x ./kubectl
|
||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||
|
||||
- name: Set up kubeconfig
|
||||
env:
|
||||
KUBE_SERVER: ${{ env.KUBE_SERVER }} # e.g. https://<API_ENDPOINT>
|
||||
KUBE_CA: ${{ env.KUBE_CA }} # base64 encoded, or fetched via kubectl config view
|
||||
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }} # Token generated via 'kubectl create token'
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
cat <<EOF > ~/.kube/config
|
||||
apiVersion: v1
|
||||
kind: Config
|
||||
clusters:
|
||||
- name: default-cluster
|
||||
cluster:
|
||||
server: "$KUBE_SERVER"
|
||||
certificate-authority-data: "$KUBE_CA"
|
||||
contexts:
|
||||
- name: default-context
|
||||
context:
|
||||
cluster: default-cluster
|
||||
user: gitea-actions
|
||||
current-context: default-context
|
||||
users:
|
||||
- name: gitea-actions
|
||||
user:
|
||||
token: "$KUBE_TOKEN"
|
||||
EOF
|
||||
|
||||
- name: Patch Deployment Image
|
||||
env:
|
||||
NAMESPACE: ${{ env.NAMESPACE }}
|
||||
DEPLOYMENT: ${{ env.DEPLOYMENT_NAME }}
|
||||
CONTAINER: ${{ env.CONTAINER }}
|
||||
run: |
|
||||
echo "deploy new tag: $TAG_IMAGE"
|
||||
env
|
||||
kubectl -n ${NAMESPACE} set image deployment/${DEPLOYMENT} ${CONTAINER}=${IMAGE_NAME}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
build/*
|
||||
*-manual.pdf
|
||||
.venv/
|
||||
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
# -------- Stage 1: Build the documentation using mkdocs --------
|
||||
FROM python:3.13-slim AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Install dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY user/ user/
|
||||
COPY admin/ admin/
|
||||
|
||||
RUN ls
|
||||
RUN cd user && mkdocs build --clean && cd ..
|
||||
RUN cd admin && mkdocs build --clean && cd ..
|
||||
|
||||
# -------- Stage 2: Serve the built documentation with nginx --------
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy the built site from the builder stage
|
||||
COPY --from=builder /build/admin/site /usr/share/nginx/html/admin
|
||||
COPY --from=builder /build/user/site /usr/share/nginx/html/user
|
||||
|
1
admin/.gitignore
vendored
Normal file
1
admin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
site/*
|
3
admin/docs/index.md
Normal file
3
admin/docs/index.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Documentation administrateur
|
||||
|
||||
En construction.
|
43
admin/mkdocs.yml
Normal file
43
admin/mkdocs.yml
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
site_name: "Manuel admnistrateur Chill"
|
||||
site_url: https://manuel.chill.social/admin
|
||||
repo_url: https://gitea.champs-libres.be/Chill-project/manuals
|
||||
repo_name: Chill-project/manuals
|
||||
theme:
|
||||
name: material
|
||||
features:
|
||||
- content.code.copy
|
||||
- content.code.select
|
||||
- content.code.annotate
|
||||
nav:
|
||||
- Accueil: index.md
|
||||
- Génération de document: generation-documents.md
|
||||
markdown_extensions:
|
||||
- markdown_include.include
|
||||
# code layout
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
use_pygments: true
|
||||
linenums: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
# admonition
|
||||
- admonition
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
# use emojis
|
||||
- attr_list
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
# footnotes
|
||||
- footnotes
|
||||
# https://squidfunk.github.io/mkdocs-material/reference/formatting/?h=key#adding-keyboard-keys
|
||||
- pymdownx.critic
|
||||
- pymdownx.caret
|
||||
- pymdownx.keys
|
||||
- pymdownx.mark
|
||||
- pymdownx.tilde
|
@ -4,7 +4,8 @@ set -e
|
||||
|
||||
# enter the current directory
|
||||
cd "$(dirname $0)"
|
||||
export PANDOC_DIR="/pandoc/cl"
|
||||
export PANDOC_DIR="$(pwd)/pandoc/cl"
|
||||
export OUTPUT_DIR="$(pwd)"
|
||||
|
||||
|
||||
if [ -z $1 ]; then
|
||||
@ -59,7 +60,9 @@ else
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
cd $kind
|
||||
export PDF_TEMPLATE="$(pwd)/eisvogel.latex"
|
||||
|
||||
cd $kind/docs
|
||||
|
||||
export ARGS="
|
||||
--from markdown
|
||||
@ -67,14 +70,12 @@ export ARGS="
|
||||
--resource-path ./.
|
||||
--metadata-file ./metadata.yaml
|
||||
"
|
||||
export PDF_TEMPLATE="./../eisvogel.latex"
|
||||
export LATEX_ARGS="
|
||||
--metadata=footer-left:$(date +%d-%m-%Y)
|
||||
--template ${PDF_TEMPLATE}
|
||||
--lua-filter "..${PANDOC_DIR}/boxes.lua"
|
||||
--lua-filter "${PANDOC_DIR}/boxes.lua"
|
||||
"
|
||||
|
||||
|
||||
if [ $target = "latex" ]; then
|
||||
pandoc $ARGS $LATEX_ARGS \
|
||||
--to latex \
|
||||
@ -83,18 +84,7 @@ elif [ $target = "pdf" ]; then
|
||||
pandoc $ARGS $LATEX_ARGS \
|
||||
--to pdf \
|
||||
--pdf-engine xelatex \
|
||||
-o "./../$kind-manual.pdf" \
|
||||
-o "${OUTPUT_DIR}/$kind-manual.pdf" \
|
||||
$files
|
||||
elif [ $target = "html" ]; then
|
||||
# check target directory exists
|
||||
if [ ! -d "./../build/html" ]; then
|
||||
echo "create build/html directory"
|
||||
mkdir -p "./../build/html"
|
||||
fi
|
||||
|
||||
pandoc $ARGS \
|
||||
--to html \
|
||||
-o ./../build/html/index.html \
|
||||
$files
|
||||
fi
|
||||
|
||||
|
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
mkdocs
|
||||
markdown-include
|
||||
mkdocs-material
|
2
user/.gitignore
vendored
Normal file
2
user/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
site/*
|
||||
|
3
user/docs/index.md
Normal file
3
user/docs/index.md
Normal file
@ -0,0 +1,3 @@
|
||||
Documentation utilisateur de chill
|
||||
|
||||
En construction.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user