chore: use latest tag instead of main
Build and Push Docker Image to GHCR / build-and-push (push) Has been cancelled

This commit is contained in:
i
2026-05-20 15:31:30 +08:00
parent 03bdec1ce0
commit d60fe49414
2 changed files with 42 additions and 36 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=ref,event=branch type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag type=ref,event=tag
type=sha,prefix=,suffix=,format=short type=sha,prefix=,suffix=,format=short
+41 -35
View File
@@ -4,76 +4,73 @@
## GHCR 镜像 ## GHCR 镜像
每次推送 `main` 分支或 `v*` 标签时,GitHub Actions 自动构建多架构镜像(linux/amd64, linux/arm64)并推送至 GHCR:
``` ```
ghcr.io/arkylin/hapi-docker:main ghcr.io/arkylin/hapi-docker:latest
ghcr.io/arkylin/hapi-docker:<sha>
ghcr.io/arkylin/hapi-docker:<tag>
``` ```
## 快速开始 ## 快速开始
### 1. 配置环境变量 ### 1. 准备目录
```bash ```bash
cp .env.example .env mkdir hapi-hub && cd hapi-hub
``` ```
编辑 `.env`,填写必要参数。 ### 2. 创建 `docker-compose.yml`
### 2. 构建并启动 ```yaml
services:
hapi-hub:
image: ghcr.io/arkylin/hapi-docker:latest
container_name: hapi-hub
restart: unless-stopped
ports:
- "3006:3006"
volumes:
- ./hapi-data:/root/.hapi
environment:
- CLI_API_TOKEN=你的令牌
- HAPI_LISTEN_HOST=0.0.0.0
- HAPI_LISTEN_PORT=3006
- HAPI_PUBLIC_URL=http://你的服务器IP:3006
```
### 3. 启动
```bash ```bash
docker compose up -d docker compose up -d
``` ```
### 3. 查看状态 ### 4. 查看日志
```bash ```bash
docker compose logs -f docker compose logs -f
``` ```
### 使用预构建镜像(跳过本地构建) 浏览器打开 `http://你的服务器IP:3006` 即可看到 HAPI Web 界面。
编辑 `docker-compose.yml`,将 `build` 替换为 `image`:
```yaml
services:
hapi-hub:
image: ghcr.io/arkylin/hapi-docker:main
container_name: hapi-hub
...
```
然后:
```bash
docker compose pull
docker compose up -d
```
## 环境变量 ## 环境变量
| 变量 | 必填 | 默认值 | 说明 | | 变量 | 必填 | 默认值 | 说明 |
|------|------|--------|------| |------|------|--------|------|
| `CLI_API_TOKEN` | 是 | - | 认证令牌,CLI 连接时使用 | | `CLI_API_TOKEN` | 是 | - | 认证令牌,CLI 连接时使用 |
| `HAPI_PUBLIC_URL` | 否 | - | Hub 公网地址,如 `http://1.2.3.4:3006` | | `HAPI_PUBLIC_URL` | 否 | - | Hub 公网地址 |
| `CORS_ORIGINS` | 否 | `*` | 允许的 CORS 域名 | | `CORS_ORIGINS` | 否 | `*` | 允许的 CORS 域名 |
| `TZ` | 否 | `Asia/Shanghai` | 时区 | | `TZ` | 否 | `Asia/Shanghai` | 时区 |
## 客户端连接 ## 客户端连接
在其他机器上配置 CLI 连接: 在其他需要远程控制的机器上:
```bash ```bash
export HAPI_API_URL="http://your-server-ip:3006" export HAPI_API_URL="http://你的服务器IP:3006"
export CLI_API_TOKEN="your-token" export CLI_API_TOKEN="你的令牌"
hapi hapi
``` ```
支持 Runner 模式: ## Runner 模式
在 Hub 容器内启动后台 Runner,支持远程拉起新会话:
```bash ```bash
docker exec hapi-hub hapi runner start --foreground docker exec hapi-hub hapi runner start --foreground
@@ -81,7 +78,16 @@ docker exec hapi-hub hapi runner start --foreground
## 持久化数据 ## 持久化数据
Hub 数据存储在当前目录 `./hapi-data/` 中,对应容器内 `/root/.hapi/`: `./hapi-data/` 挂载到容器内 `/root/.hapi/`:
- `settings.json` — 配置文件 - `settings.json` — 配置文件
- `hapi.db` — SQLite 数据库 - `hapi.db` — SQLite 数据库
## 本地构建(可选)
```bash
git clone https://github.com/arkylin/Hapi-Docker.git
cd Hapi-Docker
# 编辑 .env
docker compose up -d
```