Committed by
GitHub
Merge pull request #171 from 666ghj/fast_patch
Docker release
Showing
3 changed files
with
56 additions
and
2 deletions
.github/workflows/docker_ci.yml
0 → 100644
| 1 | +name: Docker Image CI | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + tags: | ||
| 6 | + - 'v*' | ||
| 7 | + | ||
| 8 | +jobs: | ||
| 9 | + build_and_publish: | ||
| 10 | + runs-on: ubuntu-latest | ||
| 11 | + permissions: | ||
| 12 | + contents: read | ||
| 13 | + packages: write | ||
| 14 | + | ||
| 15 | + steps: | ||
| 16 | + - name: Checkout repository | ||
| 17 | + uses: actions/checkout@v4 | ||
| 18 | + | ||
| 19 | + - name: Log in to the Container registry | ||
| 20 | + uses: docker/login-action@v3 | ||
| 21 | + with: | ||
| 22 | + registry: ghcr.io | ||
| 23 | + username: ${{ github.actor }} | ||
| 24 | + password: ${{ secrets.GITHUB_TOKEN }} | ||
| 25 | + | ||
| 26 | + - name: Extract metadata (tags, labels) for Docker | ||
| 27 | + id: meta | ||
| 28 | + uses: docker/metadata-action@v5 | ||
| 29 | + with: | ||
| 30 | + images: ghcr.io/${{ github.repository }} | ||
| 31 | + tags: | | ||
| 32 | + type=ref,event=tag | ||
| 33 | + type=semver,pattern={{version}} | ||
| 34 | + type=raw,value=latest | ||
| 35 | + | ||
| 36 | + - name: Set up Docker Buildx | ||
| 37 | + uses: docker/setup-buildx-action@v3 | ||
| 38 | + with: | ||
| 39 | + driver: docker-container | ||
| 40 | + | ||
| 41 | + - name: Build and push Docker image | ||
| 42 | + uses: docker/build-push-action@v5 | ||
| 43 | + with: | ||
| 44 | + context: . | ||
| 45 | + push: true | ||
| 46 | + tags: ${{ steps.meta.outputs.tags }} | ||
| 47 | + labels: ${{ steps.meta.outputs.labels }} | ||
| 48 | + cache-from: type=gha | ||
| 49 | + cache-to: type=gha,mode=max |
| @@ -16,6 +16,7 @@ import requests | @@ -16,6 +16,7 @@ import requests | ||
| 16 | from loguru import logger | 16 | from loguru import logger |
| 17 | import importlib | 17 | import importlib |
| 18 | from pathlib import Path | 18 | from pathlib import Path |
| 19 | +from MindSpider.main import MindSpider | ||
| 19 | 20 | ||
| 20 | # 导入ReportEngine | 21 | # 导入ReportEngine |
| 21 | try: | 22 | try: |
| @@ -223,6 +224,12 @@ def initialize_system_components(): | @@ -223,6 +224,12 @@ def initialize_system_components(): | ||
| 223 | logs = [] | 224 | logs = [] |
| 224 | errors = [] | 225 | errors = [] |
| 225 | 226 | ||
| 227 | + spider = MindSpider() | ||
| 228 | + if spider.initialize_database(): | ||
| 229 | + logger.info("数据库初始化成功") | ||
| 230 | + else: | ||
| 231 | + logger.error("数据库初始化失败") | ||
| 232 | + | ||
| 226 | try: | 233 | try: |
| 227 | stop_forum_engine() | 234 | stop_forum_engine() |
| 228 | logs.append("已停止 ForumEngine 监控器以避免文件冲突") | 235 | logs.append("已停止 ForumEngine 监控器以避免文件冲突") |
| @@ -8,8 +8,6 @@ services: | @@ -8,8 +8,6 @@ services: | ||
| 8 | image: bettafish:latest | 8 | image: bettafish:latest |
| 9 | container_name: bettafish | 9 | container_name: bettafish |
| 10 | restart: unless-stopped | 10 | restart: unless-stopped |
| 11 | - env_file: | ||
| 12 | - - .env | ||
| 13 | environment: | 11 | environment: |
| 14 | - PYTHONUNBUFFERED=1 | 12 | - PYTHONUNBUFFERED=1 |
| 15 | ports: | 13 | ports: |
-
Please register or login to post a comment