Spaces:
Sleeping
Sleeping
Update Dockerfile (#2)
Browse files- Update Dockerfile (f47d0d32b64f8a42269e12d33bbb301ab42afcec)
- Dockerfile +14 -21
Dockerfile
CHANGED
@@ -2,14 +2,12 @@ FROM python:3.9-slim
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
chmod -R 777 /app/.cache
|
8 |
-
|
9 |
-
# Create writable cache directory for Hugging Face
|
10 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
|
|
11 |
|
12 |
-
|
13 |
RUN apt-get update && apt-get install -y \
|
14 |
build-essential \
|
15 |
ffmpeg \
|
@@ -18,29 +16,24 @@ RUN apt-get update && apt-get install -y \
|
|
18 |
git \
|
19 |
&& rm -rf /var/lib/apt/lists/*
|
20 |
|
21 |
-
#
|
|
|
|
|
|
|
|
|
22 |
COPY requirements.txt ./
|
23 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
24 |
|
25 |
-
|
26 |
-
# Copy app and support folders
|
27 |
COPY app.py ./
|
28 |
COPY utils/ ./utils/
|
29 |
-
COPY models/ ./models/
|
30 |
-
COPY .streamlit/ .streamlit/
|
31 |
-
|
32 |
-
# 1) Create the cache dir
|
33 |
-
RUN mkdir -p /app/.streamlit/cache \
|
34 |
-
&& chmod -R a+rwx /app/.streamlit
|
35 |
-
|
36 |
-
|
37 |
-
# 2) Tell Streamlit where to put its cache
|
38 |
-
ENV XDG_CACHE_HOME=/app/.streamlit
|
39 |
-
|
40 |
-
|
41 |
|
42 |
EXPOSE 8501
|
43 |
|
|
|
44 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
45 |
|
|
|
46 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Set environment variables early
|
6 |
+
ENV HOME=/app
|
|
|
|
|
|
|
7 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
8 |
+
ENV XDG_CACHE_HOME=/app/.streamlit
|
9 |
|
10 |
+
# Install system dependencies
|
11 |
RUN apt-get update && apt-get install -y \
|
12 |
build-essential \
|
13 |
ffmpeg \
|
|
|
16 |
git \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
+
# Create writable cache directories
|
20 |
+
RUN mkdir -p /app/.cache/huggingface/hub /app/.streamlit && \
|
21 |
+
chmod -R 777 /app/.cache /app/.streamlit
|
22 |
+
|
23 |
+
# Copy Python dependencies
|
24 |
COPY requirements.txt ./
|
25 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
26 |
|
27 |
+
# Copy application files
|
|
|
28 |
COPY app.py ./
|
29 |
COPY utils/ ./utils/
|
30 |
+
COPY models/ ./models/
|
31 |
+
COPY .streamlit/ .streamlit/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
EXPOSE 8501
|
34 |
|
35 |
+
# Optional health check for Streamlit
|
36 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
37 |
|
38 |
+
# Run the Streamlit app
|
39 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|