Spaces:
Sleeping
Sleeping
Deploy Docker-based Streamlit app
Browse files- Dockerfile +45 -18
Dockerfile
CHANGED
|
@@ -1,30 +1,57 @@
|
|
| 1 |
# Docker runtime for HF Space
|
| 2 |
-
# Use a slim Python base
|
| 3 |
-
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
ENV
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
# Working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
RUN
|
| 13 |
-
COPY requirements.txt /app/
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
RUN mkdir -p /tmp/huggingface/hub
|
| 25 |
|
| 26 |
-
# Expose port
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
-
# Run Streamlit
|
| 30 |
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
# Docker runtime for HF Space
|
| 2 |
+
# # Use a slim Python base
|
| 3 |
+
# FROM python:3.11-slim
|
| 4 |
+
|
| 5 |
+
# # Basic hygiene
|
| 6 |
+
# ENV PIP_NO_CACHE_DIR=1 # PYTHONDONTWRITEBYTECODE=1 # PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# # Working directory
|
| 9 |
+
# WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# # Copy and install Python deps first
|
| 12 |
+
# RUN pip install scikit-learn==1.5.0
|
| 13 |
+
# COPY requirements.txt /app/
|
| 14 |
+
|
| 15 |
+
# # Install packages without dependencies to avoid conflicts
|
| 16 |
+
# 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
|
| 17 |
+
|
| 18 |
+
# # Copy app code
|
| 19 |
+
# COPY streamlit_app.py /app/
|
| 20 |
+
# COPY README.md /app/
|
| 21 |
|
| 22 |
+
# # Hugging Face caches
|
| 23 |
+
# ENV HF_HOME=/tmp/huggingface
|
| 24 |
+
# RUN mkdir -p /tmp/huggingface/hub
|
| 25 |
+
|
| 26 |
+
# # Expose port
|
| 27 |
+
# EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# # Run Streamlit
|
| 30 |
+
# CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
| 31 |
+
|
| 32 |
+
FROM python:3.11-slim
|
| 33 |
|
|
|
|
| 34 |
WORKDIR /app
|
| 35 |
|
| 36 |
+
# Install system dependencies
|
| 37 |
+
RUN apt-get update && apt-get install -y gcc g++ && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 38 |
|
| 39 |
+
# Copy requirements
|
| 40 |
+
COPY requirements.txt .
|
| 41 |
|
| 42 |
+
# Install Python packages with specific versions
|
| 43 |
+
RUN pip install --upgrade pip
|
| 44 |
+
RUN pip install streamlit==1.39.0
|
| 45 |
+
RUN pip install pandas==2.2.2
|
| 46 |
+
RUN pip install numpy==1.26.4
|
| 47 |
+
RUN pip install scikit-learn==1.5.0
|
| 48 |
+
RUN pip install scipy==1.14.0
|
| 49 |
+
RUN pip install joblib==1.4.2
|
| 50 |
+
RUN pip install huggingface_hub==0.25.1
|
| 51 |
|
| 52 |
+
# Copy app
|
| 53 |
+
COPY streamlit_app.py .
|
|
|
|
| 54 |
|
|
|
|
| 55 |
EXPOSE 7860
|
| 56 |
|
|
|
|
| 57 |
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|