Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -4
Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Set environment variables
|
| 6 |
ENV HOME=/tmp
|
| 7 |
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 8 |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
|
@@ -16,18 +16,21 @@ RUN apt-get update && apt-get install -y \
|
|
| 16 |
git \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
-
# Create cache directory
|
| 20 |
RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
|
| 21 |
|
| 22 |
COPY requirements.txt ./
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
COPY src/ ./src/
|
| 24 |
|
| 25 |
# Create .streamlit directory and config file
|
| 26 |
RUN mkdir -p /tmp/.streamlit
|
| 27 |
RUN echo '[server]\nheadless = true\nport = 8501\nenableCORS = false\nenableXsrfProtection = false\n\n[browser]\ngatherUsageStats = false' > /tmp/.streamlit/config.toml
|
| 28 |
|
| 29 |
-
RUN pip3 install -r requirements.txt
|
| 30 |
-
|
| 31 |
EXPOSE 8501
|
| 32 |
|
| 33 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Set environment variables
|
| 6 |
ENV HOME=/tmp
|
| 7 |
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 8 |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
|
|
|
| 16 |
git \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Create cache directory
|
| 20 |
RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
|
| 21 |
|
| 22 |
COPY requirements.txt ./
|
| 23 |
+
RUN pip3 install -r requirements.txt
|
| 24 |
+
|
| 25 |
+
# Pre-download the model during build time
|
| 26 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('BAAI/bge-small-en'); print('Model downloaded successfully')"
|
| 27 |
+
|
| 28 |
COPY src/ ./src/
|
| 29 |
|
| 30 |
# Create .streamlit directory and config file
|
| 31 |
RUN mkdir -p /tmp/.streamlit
|
| 32 |
RUN echo '[server]\nheadless = true\nport = 8501\nenableCORS = false\nenableXsrfProtection = false\n\n[browser]\ngatherUsageStats = false' > /tmp/.streamlit/config.toml
|
| 33 |
|
|
|
|
|
|
|
| 34 |
EXPOSE 8501
|
| 35 |
|
| 36 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|