From fcbb409a12ebba0bd8401e84e0074d65963f01fc Mon Sep 17 00:00:00 2001 From: tifisht Date: Mon, 26 Oct 2026 08:13:17 +0800 Subject: [PATCH] fix: align Docker Python version with pinned dependencies --- .github/workflows/docker-smoke.yml | 64 ++++++++++++++++++++++++++++++ Dockerfile | 2 +- README.md | 2 +- 使用文档.md | 2 +- 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker-smoke.yml diff --git a/.github/workflows/docker-smoke.yml b/.github/workflows/docker-smoke.yml new file mode 100644 index 0000000..6788c16 --- /dev/null +++ b/.github/workflows/docker-smoke.yml @@ -0,0 +1,64 @@ +name: Docker smoke test + +on: + push: + paths: + - Dockerfile + - .dockerignore + - docker-compose.yml + - entrypoint.sh + - requirements.txt + - '*.py' + - templates/** + - .github/workflows/docker-smoke.yml + pull_request: + paths: + - Dockerfile + - .dockerignore + - docker-compose.yml + - entrypoint.sh + - requirements.txt + - '*.py' + - templates/** + - .github/workflows/docker-smoke.yml + workflow_dispatch: + +permissions: + contents: read + +jobs: + build-and-start: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + + - name: Build image and check dependencies + run: | + docker build --tag netease-url:smoke . + docker run --rm netease-url:smoke python3 -m pip check + docker run --rm netease-url:smoke ffmpeg -version + + - name: Start service without account credentials + run: | + touch "$RUNNER_TEMP/netease-cookie.txt" + docker run --detach --name netease-url-smoke \ + --publish 127.0.0.1:5000:5000 \ + --mount "type=bind,src=$RUNNER_TEMP/netease-cookie.txt,dst=/app/cookie.txt,readonly" \ + netease-url:smoke + curl --fail --silent --show-error --retry 30 --retry-connrefused \ + --retry-delay 1 --max-time 5 http://127.0.0.1:5000/health > health.json + python3 - <<'PY' + import json + with open('health.json') as response: + health = json.load(response) + assert health['success'] is True, health + assert health['data']['service'] == 'running', health + assert health['data']['cookie_count'] == 0, health + PY + + - name: Show service logs and remove container + if: always() + run: | + docker logs netease-url-smoke 2>/dev/null || true + docker rm --force netease-url-smoke 2>/dev/null || true diff --git a/Dockerfile b/Dockerfile index d72206f..3953c3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9.22-alpine3.21 +FROM python:3.12-alpine3.23 WORKDIR /app RUN apk add --no-cache ffmpeg COPY requirements.txt requirements.txt diff --git a/README.md b/README.md index ecadb27..d3f20fa 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ ## 🚀 快速开始 ### 环境要求 -- Python 3.7+ +- Python 3.10+(推荐 Python 3.12,与 Docker 镜像一致) - 网易云音乐黑胶会员账号 ### 安装步骤 diff --git a/使用文档.md b/使用文档.md index 220a216..25e2138 100644 --- a/使用文档.md +++ b/使用文档.md @@ -30,7 +30,7 @@ ## 🚀 快速开始 ### 环境要求 -- Python 3.7+ +- Python 3.10+(推荐 Python 3.12,与 Docker 镜像一致) - 网易云音乐黑胶会员账号(用于获取高音质资源) ### 安装步骤