commit 91576dbaa653175e76a1dc013ec7bd7b96fe6116 Author: admin Date: Tue Jun 16 03:38:51 2026 +0800 Add NAS CI demo diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..70e836e --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,21 @@ +steps: + - name: smoke + image: alpine:3.20 + commands: + - echo "Woodpecker can clone and run this repository." + - test -f Dockerfile + - test -f index.html + + - name: build-and-push + image: docker:28-cli + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - docker version + - docker build -t localhost:5050/cicd-demo:latest . + - docker push localhost:5050/cicd-demo:latest + +when: + - event: push + branch: main + - event: manual diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f6d6210 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:1.27-alpine + +COPY index.html /usr/share/nginx/html/index.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..7528df4 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# NAS CI/CD Demo + +This is a tiny project for testing the NAS Gitea + Woodpecker + Registry flow. + +Expected pipeline: + +1. Push this repository to Gitea. +2. Enable the repository in Woodpecker. +3. Woodpecker runs `.woodpecker.yml`. +4. The pipeline builds an nginx image. +5. The image is pushed to the NAS Registry as: + +```text +localhost:5050/cicd-demo:latest +``` + +## Push To Gitea + +Create an empty repository named `cicd-demo` in Gitea first, then run: + +```bash +git init +git add . +git commit -m "Add CI demo" +git branch -M main +git remote add origin http://10.26.238.251:3000//cicd-demo.git +git push -u origin main +``` + +Replace `` with your Gitea username. + +## Verify The Built Image On NAS + +After the Woodpecker build succeeds, run this on the NAS: + +```bash +docker pull localhost:5050/cicd-demo:latest +docker rm -f cicd-demo-web 2>/dev/null || true +docker run -d --name cicd-demo-web -p 18080:80 localhost:5050/cicd-demo:latest +``` + +Open: + +```text +http://10.26.238.251:18080 +``` diff --git a/index.html b/index.html new file mode 100644 index 0000000..fd787b4 --- /dev/null +++ b/index.html @@ -0,0 +1,78 @@ + + + + + + NAS CI/CD Demo + + + +
+

NAS CI/CD Demo

+

+ 如果你看到这个页面,说明镜像已经由 Woodpecker 构建,并且可以从本地 + Registry 运行。 +

+

镜像名:localhost:5050/cicd-demo:latest

+
pipeline smoke test ready
+
+ +