From 71ceeaf70489c96c1e39c40f76fd43309dbf1442 Mon Sep 17 00:00:00 2001 From: wonder Date: Wed, 2 Sep 2026 19:40:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20Gitea=20Actions=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=83=A8=E7=BD=B2=E6=B5=81=E6=B0=B4=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nginx:alpine 托管静态站点 - push 到 main 自动构建并部署到 30000 端口 --- .gitea/workflows/deploy.yml | 41 +++++++++++++++++++++++++++++++++++++ Dockerfile | 3 +++ 2 files changed, 44 insertions(+) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..2afd144 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,41 @@ +name: Deploy Examination + +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 + + - name: Checkout + run: | + rm -rf /tmp/examination + git clone --depth 1 -b main \ + http://47.121.181.112:3000/wonder/examination.git \ + /tmp/examination + + - name: Build Docker Image + run: | + docker build \ + -t examination-site:latest \ + /tmp/examination + + - name: Deploy Container + run: | + docker stop examination-site 2>/dev/null || true + docker rm examination-site 2>/dev/null || true + docker run -d \ + --name examination-site \ + --restart unless-stopped \ + -p 30000:80 \ + examination-site:latest + + - name: Cleanup Dangling Images + run: docker image prune -f diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..269c891 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine +COPY . /usr/share/nginx/html +EXPOSE 80