ALYYAN commited on
Commit
cf2bca5
·
verified ·
1 Parent(s): 5459f30

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -11
Dockerfile CHANGED
@@ -1,24 +1,24 @@
1
  # 1. Base Image
2
  FROM python:3.11-slim
3
 
4
- # 2. Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
- ENV STREAMLIT_SERVER_HEADLESS=true
8
- ENV HF_HOME=/app/hf_cache
 
9
 
10
  # 3. Install System Dependencies for OpenCV
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
- libgl1 curl \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # 4. Set the working directory
16
  WORKDIR /app
17
- RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
18
 
19
  # 5. Copy and install Python requirements
20
  COPY requirements.txt .
21
- RUN pip install --no-cache-dir -r requirements.txt && rm -rf /root/.cache/pip
22
 
23
  # 6. Copy the rest of the application
24
  COPY . .
@@ -26,8 +26,5 @@ COPY . .
26
  # 7. Expose the correct Hugging Face Space port
27
  EXPOSE 7860
28
 
29
- # 8. (Optional) Remove healthcheck for now
30
- # HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
31
-
32
- # 9. Entrypoint
33
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
 
1
  # 1. Base Image
2
  FROM python:3.11-slim
3
 
4
+ # 2. Set environment variables to prevent permission issues
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
+ # Tell Streamlit and HF Hub to use a writable directory
8
+ ENV STREAMLIT_HOME=/app/.streamlit
9
+ ENV HF_HOME=/app/.cache/huggingface
10
 
11
  # 3. Install System Dependencies for OpenCV
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
+ libgl1 \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
  # 4. Set the working directory
17
  WORKDIR /app
 
18
 
19
  # 5. Copy and install Python requirements
20
  COPY requirements.txt .
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
 
23
  # 6. Copy the rest of the application
24
  COPY . .
 
26
  # 7. Expose the correct Hugging Face Space port
27
  EXPOSE 7860
28
 
29
+ # 8. Entrypoint with all necessary flags
30
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"]