# FVG-Delta Crypto Signal Core v7.5 — container image # Flat single-directory layout (matches the phone-friendly upload model). # Target host: Hugging Face Spaces (Docker SDK), but runs anywhere with /data writable. FROM python:3.11-slim # Matplotlib (chart PNGs for Telegram/dashboard) needs these native libs at runtime. # fonts-dejavu-core gives the charts a real default font; tini reaps zombies cleanly. RUN apt-get update && apt-get install -y --no-install-recommends \ libfreetype6 \ libpng16-16 \ fontconfig \ fonts-dejavu-core \ tini \ && rm -rf /var/lib/apt/lists/* # Persistence + matplotlib cache both live on the mounted disk (/data on HF Spaces). # The app falls back to ./data automatically if /data is not writable. ENV PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PORT=7860 \ PERSIST_DIR=/data \ MPLCONFIGDIR=/data/.mpl WORKDIR /app # Install deps first for better layer caching. COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # App sources (flat). .dockerignore keeps out *.db, settings.json, *.bak, __pycache__ etc. COPY . . # Writable persistence dir (HF mounts a volume here at runtime; create it for local runs). RUN mkdir -p /data /data/.mpl && chmod -R 777 /data RUN chmod +x start.sh || true EXPOSE 7860 # tini as PID 1 so uvicorn's children exit cleanly; start.sh runs preflight then uvicorn. ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["bash", "start.sh"]