Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +21 -10
Dockerfile
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
|
|
| 1 |
FROM python:3.13.5-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
curl \
|
| 8 |
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# Copy Python files
|
| 15 |
-
COPY app.py auth.py chat.py db.py rag.py ui_pages.py ./
|
| 16 |
-
|
| 17 |
-
# Copy additional folders
|
| 18 |
-
COPY vectordb/ ./vectordb/
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
| 22 |
|
|
|
|
| 23 |
EXPOSE 8501
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
|
|
|
| 27 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
+
# Use Python slim image
|
| 2 |
FROM python:3.13.5-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
| 11 |
git \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Ensure cache directories exist and are writable
|
| 15 |
+
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache \
|
| 16 |
+
&& mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# Copy requirements and install
|
| 19 |
+
COPY requirements.txt ./
|
| 20 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
+
# Copy all code and vectordb
|
| 23 |
+
COPY . .
|
| 24 |
|
| 25 |
+
# Expose Streamlit port
|
| 26 |
EXPOSE 8501
|
| 27 |
|
| 28 |
+
# Healthcheck
|
| 29 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 30 |
+
|
| 31 |
+
# Streamlit config to avoid creating config files in root
|
| 32 |
+
ENV STREAMLIT_HOME=/app/.streamlit
|
| 33 |
+
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 34 |
+
ENV HF_HOME=/app/.cache
|
| 35 |
+
ENV XDG_CACHE_HOME=/app/.cache
|
| 36 |
|
| 37 |
+
# Run Streamlit app
|
| 38 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|