Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +22 -7
Dockerfile
CHANGED
|
@@ -1,10 +1,17 @@
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
ENV
|
| 6 |
-
ENV
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
|
@@ -17,14 +24,22 @@ RUN apt-get update && apt-get install -y \
|
|
| 17 |
git \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
COPY requirements.txt ./
|
| 21 |
COPY src/ ./src/
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
|
|
|
| 26 |
EXPOSE 8501
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# === ENV VARS ===
|
| 7 |
+
ENV XDG_CONFIG_HOME=/tmp/.config \
|
| 8 |
+
XDG_CACHE_HOME=/tmp/.cache \
|
| 9 |
+
HF_HOME=/tmp/huggingface \
|
| 10 |
+
HF_HUB_CACHE=/tmp/huggingface/hub \
|
| 11 |
+
STREAMLIT_HOME=/tmp/.streamlit \
|
| 12 |
+
PYTHONUNBUFFERED=1
|
| 13 |
|
| 14 |
+
# === Install system packages ===
|
| 15 |
RUN apt-get update && apt-get install -y \
|
| 16 |
build-essential \
|
| 17 |
curl \
|
|
|
|
| 24 |
git \
|
| 25 |
&& rm -rf /var/lib/apt/lists/*
|
| 26 |
|
| 27 |
+
# === Create writable directories ===
|
| 28 |
+
RUN mkdir -p $XDG_CONFIG_HOME/streamlit $XDG_CACHE_HOME $HF_HUB_CACHE $STREAMLIT_HOME
|
| 29 |
+
|
| 30 |
+
# === Add basic Streamlit config ===
|
| 31 |
+
RUN echo "[server]\nheadless = true\nenableCORS = false\ndefaultPort = 8501" > $XDG_CONFIG_HOME/streamlit/config.toml
|
| 32 |
+
|
| 33 |
+
# === Copy app code ===
|
| 34 |
COPY requirements.txt ./
|
| 35 |
COPY src/ ./src/
|
| 36 |
|
| 37 |
+
# === Install Python dependencies ===
|
| 38 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 39 |
|
| 40 |
+
# === Expose port & healthcheck ===
|
| 41 |
EXPOSE 8501
|
| 42 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 43 |
|
| 44 |
+
# === Run Streamlit app ===
|
| 45 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|