File size: 1,473 Bytes
f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 f74bb64 acaeaf3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # 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"]
|