Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -36
Dockerfile
CHANGED
|
@@ -1,53 +1,35 @@
|
|
| 1 |
FROM python:3.11-slim-bookworm
|
| 2 |
|
| 3 |
-
ENV
|
| 4 |
-
PYTHONDONTWRITEBYTECODE=1 \
|
| 5 |
PYTHONUNBUFFERED=1 \
|
| 6 |
PIP_NO_CACHE_DIR=1 \
|
| 7 |
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
|
| 8 |
-
|
| 9 |
-
MPLCONFIGDIR=/tmp/
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
#
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
-
|
| 16 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
cd /app; \
|
| 28 |
-
rm -rf "${TL_DIR}" ta-lib-0.4.0-src.tar.gz; \
|
| 29 |
-
ldconfig
|
| 30 |
-
|
| 31 |
-
# Python bootstrap
|
| 32 |
-
RUN python -m pip install --upgrade pip
|
| 33 |
-
|
| 34 |
-
# Install headers needed for TA-Lib Python build (must be in the SAME env)
|
| 35 |
-
RUN pip install --no-cache-dir "numpy==1.26.4" "Cython==0.29.36" "setuptools<75"
|
| 36 |
-
|
| 37 |
-
# Build the TA-Lib Python wrapper USING the env’s Cython (regenerates code for Py3.11)
|
| 38 |
-
RUN pip install --no-cache-dir --prefer-binary --no-build-isolation "TA-Lib==0.4.24"
|
| 39 |
-
|
| 40 |
-
# Rest of your deps
|
| 41 |
-
COPY requirements.txt ./
|
| 42 |
-
RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
|
| 43 |
-
|
| 44 |
-
# App
|
| 45 |
COPY . .
|
| 46 |
|
| 47 |
ENV PORT=7860
|
| 48 |
EXPOSE 7860
|
| 49 |
|
|
|
|
| 50 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
| 51 |
CMD curl --fail http://127.0.0.1:${PORT}/_stcore/health || exit 1
|
| 52 |
|
| 53 |
-
CMD ["sh", "-c", "streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT}
|
|
|
|
| 1 |
FROM python:3.11-slim-bookworm
|
| 2 |
|
| 3 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
PIP_NO_CACHE_DIR=1 \
|
| 6 |
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
|
| 7 |
+
MPLBACKEND=Agg \
|
| 8 |
+
MPLCONFIGDIR=/tmp/mplconfig
|
| 9 |
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Minimal OS deps. (git optional but handy if you ever install from a repo)
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
curl ca-certificates git fonts-dejavu \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 16 |
+
&& mkdir -p /tmp/mplconfig
|
| 17 |
+
|
| 18 |
+
# Install Python deps
|
| 19 |
+
COPY requirements.txt .
|
| 20 |
+
# Install TA-Lib wheel explicitly first and fail fast if wheel isn't available
|
| 21 |
+
RUN python -m pip install --upgrade pip setuptools wheel \
|
| 22 |
+
&& pip install --no-cache-dir --only-binary=:all: "TA-Lib==0.6.5" \
|
| 23 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 24 |
+
|
| 25 |
+
# Your code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
ENV PORT=7860
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
+
# Healthcheck to catch boot problems early
|
| 32 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
| 33 |
CMD curl --fail http://127.0.0.1:${PORT}/_stcore/health || exit 1
|
| 34 |
|
| 35 |
+
CMD ["sh", "-c", "streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT}"]
|