File size: 1,474 Bytes
de4ca97
 
 
5a5087c
133c1eb
de4ca97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61b1f06
5a5087c
133c1eb
de4ca97
 
 
5a5087c
de4ca97
 
07952e6
de4ca97
 
 
5a5087c
61b1f06
5a5087c
de4ca97
 
07952e6
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
# 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"]