Update Dockerfile
Browse files- Dockerfile +10 -13
Dockerfile
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
-
# Set working directory
|
4 |
WORKDIR /app
|
5 |
|
6 |
-
# Create
|
7 |
-
RUN mkdir -p /
|
8 |
&& mkdir -p /app/.streamlit \
|
9 |
-
&& chmod -R 777 /
|
10 |
&& chmod -R 777 /app/.streamlit
|
11 |
|
12 |
-
# Set
|
13 |
-
ENV TRANSFORMERS_CACHE=/
|
|
|
14 |
ENV XDG_CACHE_HOME=/app/.streamlit
|
15 |
ENV HOME=/app
|
16 |
|
17 |
-
# Install system
|
18 |
RUN apt-get update && apt-get install -y \
|
19 |
build-essential \
|
20 |
ffmpeg \
|
@@ -27,21 +27,18 @@ RUN apt-get update && apt-get install -y \
|
|
27 |
COPY requirements.txt ./
|
28 |
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
-
# Copy
|
31 |
COPY app.py ./
|
32 |
COPY utils/ ./utils/
|
33 |
COPY models/ ./models/
|
34 |
COPY .streamlit/ .streamlit/
|
35 |
|
36 |
-
#
|
37 |
-
RUN chmod -R 777 /
|
38 |
&& chmod -R 777 /app/.streamlit
|
39 |
|
40 |
-
# Expose port
|
41 |
EXPOSE 8501
|
42 |
|
43 |
-
# Healthcheck (optional)
|
44 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
45 |
|
46 |
-
# Start the app
|
47 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Create both cache directories with full permissions
|
6 |
+
RUN mkdir -p /tmp/huggingface/hub \
|
7 |
&& mkdir -p /app/.streamlit \
|
8 |
+
&& chmod -R 777 /tmp/huggingface \
|
9 |
&& chmod -R 777 /app/.streamlit
|
10 |
|
11 |
+
# Set environment variables for both Streamlit and Hugging Face
|
12 |
+
ENV TRANSFORMERS_CACHE=/tmp/huggingface
|
13 |
+
ENV HF_HOME=/tmp/huggingface
|
14 |
ENV XDG_CACHE_HOME=/app/.streamlit
|
15 |
ENV HOME=/app
|
16 |
|
17 |
+
# Install system-level packages
|
18 |
RUN apt-get update && apt-get install -y \
|
19 |
build-essential \
|
20 |
ffmpeg \
|
|
|
27 |
COPY requirements.txt ./
|
28 |
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
+
# Copy application files
|
31 |
COPY app.py ./
|
32 |
COPY utils/ ./utils/
|
33 |
COPY models/ ./models/
|
34 |
COPY .streamlit/ .streamlit/
|
35 |
|
36 |
+
# Ensure permissions are still correct
|
37 |
+
RUN chmod -R 777 /tmp/huggingface \
|
38 |
&& chmod -R 777 /app/.streamlit
|
39 |
|
|
|
40 |
EXPOSE 8501
|
41 |
|
|
|
42 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
43 |
|
|
|
44 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|