Add NAS CI demo
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
COPY index.html /usr/share/nginx/html/index.html
|
||||
@@ -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/<your-gitea-user>/cicd-demo.git
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
Replace `<your-gitea-user>` 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
|
||||
```
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>NAS CI/CD Demo</title>
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
background: #0f172a;
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
body {
|
||||
display: grid;
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
main {
|
||||
width: min(680px, calc(100vw - 48px));
|
||||
padding: 40px;
|
||||
border: 1px solid #334155;
|
||||
border-radius: 8px;
|
||||
background: #111827;
|
||||
box-shadow: 0 24px 64px rgb(0 0 0 / 0.28);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0 0 12px;
|
||||
font-size: 32px;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 16px;
|
||||
color: #cbd5e1;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
background: #1f2937;
|
||||
color: #93c5fd;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
color: #86efac;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 999px;
|
||||
background: #22c55e;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>NAS CI/CD Demo</h1>
|
||||
<p>
|
||||
如果你看到这个页面,说明镜像已经由 Woodpecker 构建,并且可以从本地
|
||||
Registry 运行。
|
||||
</p>
|
||||
<p>镜像名:<code>localhost:5050/cicd-demo:latest</code></p>
|
||||
<div class="status"><span class="dot"></span> pipeline smoke test ready</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user