Skip to content

Commit 7e03592

Browse files
committed
feat: 更新 README 和 docker-compose.yml,优化 Docker 部署说明
1 parent 425a8e4 commit 7e03592

2 files changed

Lines changed: 51 additions & 20 deletions

File tree

README.md

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,80 @@
2525

2626
## 部署
2727

28-
### Docker(推荐)
28+
### Docker Hub 镜像(推荐)
2929

30-
**docker compose(推荐)**
30+
镜像地址:`docker.io/charyeahowo/nyaovo-random-image-api:latest`
31+
32+
每次 push 到 `main` 分支会通过 GitHub Actions 自动构建并推送。
33+
34+
<details>
35+
<summary><b>docker compose 部署(点击展开)</b></summary>
3136

3237
```bash
33-
git clone https://github.com/user/nyaovo-random-image-api.git
34-
cd nyaovo-random-image-api
38+
# 下载配置文件
39+
curl -O https://raw.githubusercontent.com/charyeahowo/nyaovo-random-image-api/main/docker-compose.yml
3540

36-
# 修改环境变量
37-
cp .env.example .env
38-
# 编辑 .env,至少修改 ADMIN_PASSWORD 和 SESSION_SECRET
41+
# 编辑 docker-compose.yml,修改 ADMIN_PASSWORD 和 SESSION_SECRET
3942

40-
docker compose up -d --build
43+
# 启动
44+
docker compose up -d
4145
```
4246

4347
访问 `http://localhost:3400/image`,后台 `http://localhost:3400/image/admin`
4448

45-
**docker run**
49+
</details>
4650

47-
```bash
48-
docker build -t nyaovo-random-image-api .
51+
<details>
52+
<summary><b>docker run 部署(点击展开)</b></summary>
4953

54+
```bash
5055
docker run -d \
5156
--name nyaovo \
5257
-p 3400:3000 \
5358
-v ./images:/app/public/images \
5459
-e ADMIN_PASSWORD=your-password \
5560
-e SESSION_SECRET=your-secret \
5661
-e PUBLIC_BASE_URL=http://localhost:3400 \
57-
nyaovo-random-image-api
62+
--restart unless-stopped \
63+
charyeahowo/nyaovo-random-image-api:latest
5864
```
5965

6066
> 挂载的 `images` 目录需要写权限,不要加 `:ro`
6167
62-
**1Panel 部署**
68+
</details>
69+
70+
<details>
71+
<summary><b>本地构建部署(点击展开)</b></summary>
72+
73+
```bash
74+
git clone https://github.com/charyeahowo/nyaovo-random-image-api.git
75+
cd nyaovo-random-image-api
76+
77+
cp .env.example .env
78+
# 编辑 .env,至少修改 ADMIN_PASSWORD 和 SESSION_SECRET
79+
80+
docker compose up -d --build
81+
```
82+
83+
如需使用本地构建而非远程镜像,将 `docker-compose.yml` 中的 `image` 行替换为:
84+
85+
```yaml
86+
build:
87+
context: .
88+
dockerfile: Dockerfile
89+
```
90+
91+
</details>
92+
93+
<details>
94+
<summary><b>1Panel 部署(点击展开)</b></summary>
6395
6496
1. 新建 Docker Compose 编排,上传项目或 Git 拉取
65-
2. 使用项目自带 `docker-compose.yml`修改环境变量
97+
2. 使用项目自带 `docker-compose.yml`,创建 `.env` 文件填写环境变量
6698
3. 启动后在 OpenResty / Nginx 配置反向代理绑定域名
6799

100+
</details>
101+
68102
### 本地运行
69103

70104
```bash

docker-compose.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
services:
22
nyaovo-random-image-api:
3-
image: nyaovo-random-image-api:latest
4-
build:
5-
context: .
6-
dockerfile: Dockerfile
3+
image: charyeahowo/nyaovo-random-image-api:latest
74
container_name: nyaovo-random-image-api
85
ports:
96
- "3400:3000"
@@ -17,8 +14,8 @@ services:
1714
RATE_LIMIT_WINDOW_MS: 60000
1815
RATE_LIMIT_MAX: 120
1916
ADMIN_USERNAME: admin
20-
ADMIN_PASSWORD: changeme
21-
SESSION_SECRET: please-change-this
17+
ADMIN_PASSWORD: changeme # ← 务必修改
18+
SESSION_SECRET: please-change-this # ← 务必修改
2219
ADMIN_PATH: /image/admin
2320
MAX_FILE_SIZE_MB: 10
2421
MAX_UPLOAD_FILES: 20

0 commit comments

Comments
 (0)