添加部署相关
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-11-08 05:42:10 +08:00
parent d85723c44c
commit dbaacaa582
7 changed files with 115 additions and 3 deletions

15
.dockerignore Normal file
View File

@ -0,0 +1,15 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
site/
.cache/
# Virtual environments
.venv
# deploy scripts
/deploy

54
.drone.yml Normal file
View File

@ -0,0 +1,54 @@
kind: pipeline
type: docker
name: 构建静态站点
trigger:
event:
- push
branch:
- master
steps:
- name: 构建 Docker 镜像
image: plugins/docker:latest
privileged: true
settings:
username: kagami-ci
password:
from_secret: KAGAMI-CI-PASSWORD
repo: gitea.service.jazzwhom.top/mttu-developers/docs
registry: gitea.service.jazzwhom.top
tags:
- latest
- latest-${DRONE_COMMIT_SHA}
dockerfile: Dockerfile
volumes:
- name: docker-socket
path: /var/run/docker.sock
- name: 部署到服务器
image: plugins/ansible:3
settings:
playbook: deploy/deploy.ansible.yml
inventory: deploy/inventory.ini
primary_key:
from_secret: CI-DEPLOY-KEY
user:
from_secret: CI-DEPLOY-USER
limit:
from_secret: CI-DEPLOY-SERVER
- name: 发送构建结果到 ntfy
image: parrazam/drone-ntfy
when:
status: [success, failure]
settings:
url: https://ntfy.service.jazzwhom.top
topic: drone_ci
tags:
- drone-ci
token:
from_secret: NTFY_TOKEN
volumes:
- name: docker-socket
host:
path: /var/run/docker.sock

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM astral/uv:python3.12-bookworm-slim AS builder
RUN apt-get update && \
apt-get install -y git --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY pyproject.toml .
COPY uv.lock .
RUN uv sync --locked
COPY . .
RUN uv run mkdocs build
FROM nginx:alpine
COPY --from=builder /app/site /usr/share/nginx/html

17
deploy/deploy.ansible.yml Normal file
View File

@ -0,0 +1,17 @@
---
- name: 部署最新版文档
hosts: jazzwhom_server
gather_facts: no
vars:
app_path: /opt/mttu-doc
tasks:
- name: 上传文件
ansible.builtin.copy:
src: docker-compose.yml
dest: "{{ app_path }}/docker-compose.yml"
- name: 启动服务
community.docker.docker_compose_v2:
project_src: "{{ app_path }}"
state: present
pull: yes

View File

@ -0,0 +1,4 @@
services:
mttu-doc-web:
image: gitea.service.jazzwhom.top/mttu-developers/docs:latest
restart: unless-stopped

3
deploy/inventory.ini Normal file
View File

@ -0,0 +1,3 @@
[jazzwhom_server]
# Placeholder target only...
deploy_target_host ansible_host=127.0.0.1 ansible_user=placeholder

View File

@ -33,6 +33,7 @@ plugins:
- search
- git-revision-date-localized:
enable_creation_date: true
site_url: https://mttu.passthem.top
theme:
name: material
language: zh
@ -53,19 +54,19 @@ theme:
primary: teal
toggle:
icon: material/brightness-auto
name: Switch to light mode
name: 切换到亮色模式
- media: "(prefers-color-scheme: light)"
primary: teal
scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
name: 切换到暗色模式
- media: "(prefers-color-scheme: dark)"
primary: teal
scheme: slate
toggle:
icon: material/brightness-4
name: Switch to system preference
name: 切换到系统偏好模式
repo_url: https://gitea.service.jazzwhom.top/mttu-developers/mttu-docs
repo_name: mttu-developers/mttu-docs
edit_uri: _edit/master/docs/