# FVG-Delta Forex Signal Engine v6.0 — Hugging Face Spaces (Docker SDK) # --------------------------------------------------------------------- # Builds the FastAPI scanner image. The Space mounts a Xet Storage Bucket at # /data (read-write); the engine persists Trade History (SQLite) + live state # (JSON) there via persistence.py, so state survives restarts. # # Local run: # docker build -t fvg-forex . # docker run -p 7860:7860 --env-file .env -v $PWD/data:/data fvg-forex FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PORT=7860 \ FVG_DATA_DIR=/data \ MPLBACKEND=Agg \ MPLCONFIGDIR=/tmp/mpl # System libs: curl_cffi needs libcurl/openssl; matplotlib needs basic fonts. RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ libcurl4 \ libssl-dev \ fonts-dejavu-core \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install deps first for layer caching. COPY requirements.txt /app/requirements.txt RUN python -m pip install --upgrade pip \ && pip install -r /app/requirements.txt # App source (all flat files — no subfolders). COPY . /app # HF Spaces are non-root; ensure the data mount + matplotlib cache are writable. RUN mkdir -p /data /tmp/mpl && chmod -R 777 /data /tmp/mpl EXPOSE 7860 # start.sh runs preflight then launches uvicorn on $PORT. RUN chmod +x /app/start.sh || true CMD ["bash", "start.sh"]