Update Dockerfile
Browse files- Dockerfile +20 -26
Dockerfile
CHANGED
|
@@ -1,38 +1,32 @@
|
|
| 1 |
-
|
| 2 |
-
FROM python:3.9-slim
|
| 3 |
-
|
| 4 |
-
# Optionally allow overriding port at build time
|
| 5 |
-
ARG PORT=7860
|
| 6 |
-
ENV PORT=${PORT}
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
-
# Install
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
libsm6 \
|
| 16 |
-
libxrender1 \
|
| 17 |
-
libxext6 \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
# Copy dependency
|
| 21 |
-
COPY requirements.txt
|
| 22 |
-
COPY
|
| 23 |
|
| 24 |
# Install Python dependencies
|
| 25 |
-
RUN
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
EXPOSE
|
| 32 |
|
| 33 |
-
# Healthcheck
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
-
#
|
| 38 |
-
|
|
|
|
| 1 |
+
FROM python:3.13.5-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install OS-level dependencies if your app needs them (e.g. building wheels, git, curl)
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
build-essential \
|
| 8 |
+
curl \
|
| 9 |
+
git \
|
|
|
|
|
|
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Copy dependency spec and source code
|
| 13 |
+
COPY requirements.txt ./
|
| 14 |
+
COPY src/ ./src/
|
| 15 |
|
| 16 |
# Install Python dependencies
|
| 17 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
+
# (Optional) Set environment variables useful in HF Spaces / container environment
|
| 20 |
+
# Avoid Streamlit trying to write to root directories it might not have permission to.
|
| 21 |
+
ENV STREAMLIT_HOME=/tmp/.streamlit
|
| 22 |
+
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
| 23 |
|
| 24 |
+
# Expose the port used by Streamlit in HF (8501)
|
| 25 |
+
EXPOSE 8501
|
| 26 |
|
| 27 |
+
# Healthcheck: test whether Streamlit's health endpoint is alive
|
| 28 |
+
# But note: there are known issues with Streamlit health endpoint in some environments. :contentReference[oaicite:2]{index=2}
|
| 29 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 30 |
|
| 31 |
+
# Launch Streamlit app; bind to 0.0.0.0 so external connections work
|
| 32 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|