diff --git a/Dockerfile b/Dockerfile index b6fc51f..5206651 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ WORKDIR /app COPY . . ARG VERSION=dev +LABEL org.opencontainers.image.version=${VERSION} RUN GOOS=linux go build -ldflags="-s -w -X main.version=${VERSION}" -o /app/zenfeed ./main.go FROM alpine:latest @@ -15,5 +16,6 @@ RUN apk add --no-cache ca-certificates tzdata && \ COPY --from=builder /app/zenfeed /app/ +WORKDIR /app ENTRYPOINT ["/app/zenfeed"] CMD ["--config", "/app/config/config.yaml"] \ No newline at end of file diff --git a/README.md b/README.md index 5c44835..59d6833 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ curl -L -O https://raw.githubusercontent.com/glidea/zenfeed/main/docker-compose. # 如果你需要自定义更多配置参数,请直接编辑(执行下方命令前) docker-compose.yml#configs.zenfeed_config.content # 配置文档 https://github.com/glidea/zenfeed/blob/main/docs/config-zh.md -API_KEY=your_apikey docker-compose up -d +API_KEY=your_apikey docker-compose -p zenfeed up -d ``` #### Windows @@ -80,7 +80,7 @@ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/glidea/zenfeed/main/do # 如果你需要自定义更多配置参数,请直接编辑(执行下方命令前) docker-compose.yml#configs.zenfeed_config.content # 配置文档 https://github.com/glidea/zenfeed/blob/main/docs/config-zh.md -$env:API_KEY = "your_apikey"; docker-compose up -d +$env:API_KEY = "your_apikey"; docker-compose -p zenfeed up -d ``` ### 2. 使用 Web 端 @@ -95,6 +95,7 @@ $env:API_KEY = "your_apikey"; docker-compose up -d > 从 Follow 迁移过来,参考 [migrate-from-follow.md](docs/migrate-from-follow.md) > 需要访问对应的源站,请保证网络畅通 +> 添加后稍等几分钟,特别模型有严格速率限制的情况下 #### 配置每日简报,监控等 diff --git a/docker-compose.yml b/docker-compose.yml index 40639d8..e70f350 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,11 +10,23 @@ services: zenfeed: image: glidea/zenfeed:latest + entrypoint: > + sh -c " + if [ ! -f /app/config/config.yaml ]; then + echo 'Config file not found in volume, initializing from base config...' + cp /app/config.base.yaml /app/config/config.yaml; + else + echo 'Existing config file found in volume.' + fi && + echo 'Starting Zenfeed...' && + exec /app/zenfeed --config /app/config/config.yaml + " configs: - - source: zenfeed_config - target: /app/config/config.yaml + - source: zenfeed_config_base + target: /app/config.base.yaml volumes: - data:/app/data + - config:/app/config ports: - "1300:1300" - "1301:1301" @@ -30,9 +42,10 @@ services: volumes: data: {} + config: {} configs: - zenfeed_config: + zenfeed_config_base: content: | timezone: ${TZ:-Asia/Shanghai} llms: @@ -40,11 +53,11 @@ configs: default: true provider: siliconflow model: Qwen/Qwen2.5-7B-Instruct - api_key: ${API_KEY} + api_key: ${API_KEY:-your-api-key} - name: embed provider: siliconflow embedding_model: Pro/BAAI/bge-m3 - api_key: ${API_KEY} + api_key: ${API_KEY:-your-api-key} scrape: rsshub_endpoint: http://rsshub:1200 storage: diff --git a/docs/images/upgrade-from-v0.1.0-backup.png b/docs/images/upgrade-from-v0.1.0-backup.png new file mode 100644 index 0000000..3403146 Binary files /dev/null and b/docs/images/upgrade-from-v0.1.0-backup.png differ diff --git a/docs/upgrade-from-v0.1.0.md b/docs/upgrade-from-v0.1.0.md new file mode 100644 index 0000000..32f19db --- /dev/null +++ b/docs/upgrade-from-v0.1.0.md @@ -0,0 +1,28 @@ +## 0. Check your current version +```bash +# Mac/Linux +docker inspect glidea/zenfeed:latest | grep version + +# Windows PowerShell +docker inspect glidea/zenfeed:latest | Select-String -Pattern 'version' +``` + +If you **don't see any results**, it means you're using version v0.1.0. This is because the first version didn't include version information. Therefore, **this document applies to you.** + +## 1. Move your data to the correct volume path +```bash +docker-compose -p zenfeed exec zenfeed cp -a /data/. /app/data/ +``` + +## 2. Backup your config +Access: http://localhost:1400 +![](images/upgrade-from-v0.1.0-backup.png) + +## 3. Upgrade +See [upgrade](./upgrade.md) + +## 4. Resave your config +Access: http://localhost:1400 +Resave your config. + +These tedious steps are due to the oversight in the deployment form of the first version, and I apologize for that. Subsequent versions will not require these extra steps. diff --git a/docs/upgrade.md b/docs/upgrade.md new file mode 100644 index 0000000..b1552ae --- /dev/null +++ b/docs/upgrade.md @@ -0,0 +1,19 @@ +**NOTE:** If you are upgrading from v0.1.0, which is the first version, please refer to [upgrade-from-v0.1.0.md](./upgrade-from-v0.1.0.md) + +```bash +# Ensure compose yml up to date. +## Mac/Linux +curl -L -O https://raw.githubusercontent.com/glidea/zenfeed/main/docker-compose.yml +## Windows PowerShell +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/glidea/zenfeed/main/docker-compose.yml" -OutFile ([System.IO.Path]::GetFileName("https://raw.githubusercontent.com/glidea/zenfeed/main/docker-compose.yml")) + + +# Ensure images up to date. +docker-compose -p zenfeed pull + + +# Upgrading without reconfiguring, etc APIKey. +docker-compose -p zenfeed up -d +``` + +Then all the feed data and configurations should be intact.