Spaces:
Sleeping
Sleeping
Deploy Docker-based Streamlit app
Browse files- Dockerfile +9 -19
- requirements.txt +2 -2
Dockerfile
CHANGED
|
@@ -8,32 +8,22 @@ ENV PIP_NO_CACHE_DIR=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
|
|
| 8 |
# Working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
#RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
| 13 |
-
|
| 14 |
-
# Copy and install Python deps first (better layer caching)
|
| 15 |
-
#COPY requirements.txt .
|
| 16 |
COPY requirements.txt /app/
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
# Copy app code
|
| 21 |
-
#COPY streamlit_app.py .
|
| 22 |
-
# Copy only what you need for the app
|
| 23 |
COPY streamlit_app.py /app/
|
| 24 |
COPY README.md /app/
|
| 25 |
|
| 26 |
-
# Hugging Face caches
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
# Streamlit defaults for Docker
|
| 30 |
-
#ENV STREAMLIT_BROWSER_GATHERUSAGESTATS=false
|
| 31 |
-
|
| 32 |
-
# (Optional) if you keep static assets, copy them here too
|
| 33 |
-
# COPY assets/ /app/assets/
|
| 34 |
|
| 35 |
-
# Expose
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
-
# Run Streamlit
|
| 39 |
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 8 |
# Working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
+
# Copy and install Python deps first
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
COPY requirements.txt /app/
|
| 13 |
+
|
| 14 |
+
# Install packages without dependencies to avoid conflicts
|
| 15 |
+
RUN pip install --upgrade pip && pip install --no-deps -r requirements.txt && pip install streamlit==1.39.0 pandas==2.2.2 numpy==1.26.4 scikit-learn==1.4.2 scipy==1.11.4 joblib==1.4.2 huggingface_hub==0.25.1
|
| 16 |
|
| 17 |
# Copy app code
|
|
|
|
|
|
|
| 18 |
COPY streamlit_app.py /app/
|
| 19 |
COPY README.md /app/
|
| 20 |
|
| 21 |
+
# Hugging Face caches
|
| 22 |
+
ENV HF_HOME=/tmp/huggingface
|
| 23 |
+
RUN mkdir -p /tmp/huggingface/hub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
# Expose port
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Run Streamlit
|
| 29 |
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
streamlit==1.
|
| 2 |
pandas==2.2.2
|
| 3 |
numpy==1.26.4
|
| 4 |
-
scipy==1.11.4
|
| 5 |
scikit-learn==1.4.2
|
|
|
|
| 6 |
joblib==1.4.2
|
| 7 |
huggingface_hub==0.25.1
|
|
|
|
| 1 |
+
streamlit==1.39.0
|
| 2 |
pandas==2.2.2
|
| 3 |
numpy==1.26.4
|
|
|
|
| 4 |
scikit-learn==1.4.2
|
| 5 |
+
scipy==1.11.4
|
| 6 |
joblib==1.4.2
|
| 7 |
huggingface_hub==0.25.1
|