Brings the pre-migration compose file up to the current architecture: python 3.13 image with ffmpeg + faster-whisper/yt-dlp (transcripts), postgres 16 -> 18 (prod parity), and the real service set — loop (--no-dashboard, heartbeat healthcheck), dashboard_api.py on :8765, telegram qabot, youtube transcripts, and a 20:00-ET weekday scheduler replacing the premarket-eval systemd timer. Jobs (journal/eod-replay/ nightly-tune) and Grafana keep their profiles. Self-contained by default (in-stack DATABASE_URL); deploy/docker/README.md documents the pg_dump migration, the transition mode against the LAN DB, and the cutover checklist. Validated: image builds, compose config passes, and a smoke container served the dashboard (HTTP 200) against the live LAN Postgres. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
1.7 KiB
Docker
46 lines
1.7 KiB
Docker
# Momentum System — container image
|
|
#
|
|
# Single image for every run mode (the app is a monolith run from the repo root
|
|
# with PYTHONPATH=/app, not a pip-installed wheel — see pyproject.toml
|
|
# `package = false`). The Kubernetes workloads override CMD:
|
|
# - app Deployment : python run_live_paper.py (loop + embedded dashboard)
|
|
# - CronJobs : python eod_replay.py / nightly_tune.py / momentum_cli.py journal
|
|
FROM python:3.13-slim
|
|
|
|
# psycopg2-binary ships its own libpq, so no build toolchain is needed; we only
|
|
# add a tiny client for healthchecks/debugging and clean up the apt cache.
|
|
# ffmpeg: yt-dlp audio extraction for the transcripts pipeline; curl: healthchecks
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends libpq5 ffmpeg curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONPATH=/app \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
TZ=America/New_York
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies first so they cache across code-only changes.
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt \
|
|
# transcripts pipeline (CPU whisper); heavy layer, cached separately
|
|
&& pip install --no-cache-dir faster-whisper yt-dlp
|
|
|
|
# Application code.
|
|
COPY . .
|
|
|
|
# Run as a non-root user that owns the writable data dir (DuckDB research file,
|
|
# logs, learned_params.json, schwab tokens). In K8s this path is a mounted PVC.
|
|
RUN useradd --create-home --uid 10001 app \
|
|
&& mkdir -p /app/data \
|
|
&& chown -R app:app /app/data
|
|
USER app
|
|
|
|
EXPOSE 8765
|
|
|
|
# Default to the headless loop; the chart's app Deployment runs it WITH the
|
|
# dashboard, and the CronJobs override this entirely.
|
|
CMD ["python", "run_live_paper.py", "--no-dashboard"]
|