Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +26 -25
Dockerfile
CHANGED
|
@@ -1,36 +1,37 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
# Copy
|
| 17 |
-
COPY . .
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
RUN
|
| 21 |
-
&&
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 26 |
-
ENV HF_HOME=/app/.cache
|
| 27 |
-
ENV XDG_CACHE_HOME=/app/.cache
|
| 28 |
|
| 29 |
-
# Expose the Streamlit port
|
| 30 |
EXPOSE 8501
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
|
|
|
| 34 |
|
| 35 |
-
# Run
|
| 36 |
-
|
|
|
|
| 1 |
+
# Use official Python 3.13 slim image
|
| 2 |
+
FROM python:3.13-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Set environment variables for cache and Streamlit
|
| 8 |
+
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 9 |
+
ENV HF_HOME=/app/.cache
|
| 10 |
+
ENV XDG_CACHE_HOME=/app/.cache
|
| 11 |
+
ENV STREAMLIT_HOME=/app/.streamlit
|
| 12 |
+
ENV PYTHONUNBUFFERED=1
|
| 13 |
|
| 14 |
+
# Create writable directories for cache and vector DBs
|
| 15 |
+
RUN mkdir -p /app/.cache/huggingface \
|
| 16 |
+
&& mkdir -p /app/.streamlit \
|
| 17 |
+
&& mkdir -p /app/vectordb
|
| 18 |
|
| 19 |
+
# Copy only requirements first (for caching in Docker build)
|
| 20 |
+
COPY requirements.txt .
|
| 21 |
|
| 22 |
+
# Upgrade pip and install dependencies
|
| 23 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
| 24 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
+
# Copy the rest of your app
|
| 27 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
# Expose the default Streamlit port
|
| 30 |
EXPOSE 8501
|
| 31 |
|
| 32 |
+
# Set Streamlit to run in headless mode
|
| 33 |
+
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 34 |
+
ENV STREAMLIT_SERVER_ENABLE_CORS=false
|
| 35 |
|
| 36 |
+
# Run Streamlit
|
| 37 |
+
CMD ["streamlit", "run", "app.py"]
|