TaahKay commited on
Commit
b6dff27
·
verified ·
1 Parent(s): 66d169f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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 needed directories first with full permissions
7
- RUN mkdir -p /app/.cache/huggingface/hub \
8
  && mkdir -p /app/.streamlit \
9
- && chmod -R 777 /app/.cache \
10
  && chmod -R 777 /app/.streamlit
11
 
12
- # Set env variables BEFORE installing anything
13
- ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
 
14
  ENV XDG_CACHE_HOME=/app/.streamlit
15
  ENV HOME=/app
16
 
17
- # Install system dependencies
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 app code
31
  COPY app.py ./
32
  COPY utils/ ./utils/
33
  COPY models/ ./models/
34
  COPY .streamlit/ .streamlit/
35
 
36
- # Fix permissions again AFTER copying files (important)
37
- RUN chmod -R 777 /app/.cache \
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"]