- .gitea/workflows/deploy.yaml: Actions pipeline - Dockerfile: nginx:alpine serving site/ - nginx.conf: SPA routing + gzip + cache - .dockerignore: exclude source files - .gitignore: exclude site/ (built in CI)
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
name: Deploy Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: aliyun
|
||||
steps:
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
apk add --no-cache docker-cli python3 py3-pip
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
rm -rf /tmp/docs
|
||||
git clone --depth 1 -b main \
|
||||
http://47.121.181.112:3000/wonder/docs.git \
|
||||
/tmp/docs
|
||||
|
||||
- name: Build MkDocs
|
||||
run: |
|
||||
cd /tmp/docs
|
||||
pip install mkdocs-material -i https://mirrors.aliyun.com/pypi/simple/ --break-system-packages
|
||||
mkdocs build
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build \
|
||||
--cache-from docs-site:latest \
|
||||
-t docs-site:latest \
|
||||
/tmp/docs
|
||||
env:
|
||||
DOCKER_BUILDKIT: 1
|
||||
|
||||
- name: Deploy Container
|
||||
run: |
|
||||
docker stop docs-site 2>/dev/null || true
|
||||
docker rm docs-site 2>/dev/null || true
|
||||
docker run -d \
|
||||
--name docs-site \
|
||||
--restart unless-stopped \
|
||||
-p 20000:80 \
|
||||
docs-site:latest
|
||||
|
||||
- name: Cleanup Dangling Images
|
||||
run: docker image prune -f
|
||||
Reference in New Issue
Block a user