From a9bdf3b46c0edf00367b8cee71ad69688003e507 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sun, 26 Jul 2026 22:53:19 +0000 Subject: [PATCH] chore: add arm64 container deployment and Gitea CI --- .dockerignore | 11 +++++++++++ .gitea/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ Dockerfile | 31 +++++++++++++++++++++++++++++++ docker-compose.yml | 27 +++++++++++++++++++++++++++ scripts/run.sh | 11 +++++++++++ 5 files changed, 108 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/ci.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 scripts/run.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..85897b5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.gitea +.github +.venv +.playwright +__pycache__ +*.py[cod] +*.log +.env +results +screenshots diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..11070a2 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + version: "0.11.6" + enable-cache: true + + - name: Validate lockfile and install dependencies + run: uv sync --locked --group runtime --group ml --group dev + + - name: Compile Python sources + run: uv run --frozen python -m compileall -q dashboard scrapers scoring backtesting ml ml_engine llm_client scripts orchestrator.py + + - name: Run tests + run: uv run --frozen pytest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73fc546 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# syntax=docker/dockerfile:1.7 +FROM ghcr.io/astral-sh/uv:0.11.6 AS uv +FROM python:3.13.5-slim-bookworm + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \ + UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + +COPY --from=uv /uv /uvx /bin/ + +WORKDIR /app + +COPY pyproject.toml uv.lock ./ +RUN uv sync --frozen --no-install-project --no-dev --group runtime --group ml \ + && uv run --frozen --no-dev --group runtime --group ml \ + playwright install --with-deps chromium \ + && chmod -R a+rX /ms-playwright + +COPY --chown=10001:10001 . . +RUN mkdir -p /app/data /app/config \ + && chown -R 10001:10001 /app/data /app/config + +USER 10001:10001 +EXPOSE 3088 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ + CMD ["/app/.venv/bin/python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:3088/health/live', timeout=3)"] + +CMD ["/app/.venv/bin/python", "-m", "uvicorn", "dashboard.server:app", "--host", "0.0.0.0", "--port", "3088"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..006f92b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +services: + btc-monitor: + build: + context: . + image: btc-accumulation-monitor:local + ports: + - "3088:3088" + restart: unless-stopped + environment: + PLAYWRIGHT_BROWSERS_PATH: /ms-playwright + volumes: + - btc-monitor-data:/app/data + - btc-monitor-config:/app/config + healthcheck: + test: + - CMD + - /app/.venv/bin/python + - -c + - "import urllib.request; urllib.request.urlopen('http://127.0.0.1:3088/health/live', timeout=3)" + interval: 30s + timeout: 5s + start_period: 30s + retries: 3 + +volumes: + btc-monitor-data: + btc-monitor-config: diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 0000000..8ff353c --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$ROOT" + +export PYTHONPATH="${PYTHONPATH:-.}" +export PLAYWRIGHT_BROWSERS_PATH="${PLAYWRIGHT_BROWSERS_PATH:-$ROOT/.playwright}" + +exec uv run --frozen --no-dev --group runtime --group ml \ + python -m uvicorn dashboard.server:app --host 0.0.0.0 --port "${PORT:-3088}"