Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -4
Dockerfile
CHANGED
|
@@ -9,22 +9,30 @@ RUN apt-get update && apt-get install -y \
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
| 12 |
COPY requirements.txt ./
|
| 13 |
COPY src/ ./src/
|
|
|
|
| 14 |
|
|
|
|
| 15 |
RUN pip3 install -r requirements.txt
|
| 16 |
|
|
|
|
| 17 |
EXPOSE 8501
|
| 18 |
|
|
|
|
| 19 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
ENV TRANSFORMERS_CACHE=/data/cache/transformers
|
| 24 |
ENV HF_HOME=/data/cache/huggingface
|
| 25 |
ENV TORCH_HOME=/data/cache/torch
|
| 26 |
ENV SENTENCE_TRANSFORMERS_HOME=/data/cache/sentence_transformers
|
| 27 |
ENV STREAMLIT_CONFIG_DIR=/data/.streamlit
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Copy files
|
| 13 |
COPY requirements.txt ./
|
| 14 |
COPY src/ ./src/
|
| 15 |
+
COPY .streamlit/ /data/.streamlit/
|
| 16 |
|
| 17 |
+
# Install Python dependencies
|
| 18 |
RUN pip3 install -r requirements.txt
|
| 19 |
|
| 20 |
+
# Expose streamlit port
|
| 21 |
EXPOSE 8501
|
| 22 |
|
| 23 |
+
# Healthcheck for Hugging Face Spaces
|
| 24 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 25 |
|
| 26 |
+
# Environment variables for cache & config directories
|
|
|
|
| 27 |
ENV TRANSFORMERS_CACHE=/data/cache/transformers
|
| 28 |
ENV HF_HOME=/data/cache/huggingface
|
| 29 |
ENV TORCH_HOME=/data/cache/torch
|
| 30 |
ENV SENTENCE_TRANSFORMERS_HOME=/data/cache/sentence_transformers
|
| 31 |
ENV STREAMLIT_CONFIG_DIR=/data/.streamlit
|
| 32 |
|
| 33 |
+
# Create and set permissions on data directories
|
| 34 |
+
RUN mkdir -p /data/cache && \
|
| 35 |
+
chmod -R 777 /data
|
| 36 |
+
|
| 37 |
+
# Launch streamlit app
|
| 38 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|