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@v6 - 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-all-errors \ --retry-delay 1 --retry-max-time 60 --max-time 5 \ --output health.json http://127.0.0.1:5000/health 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