subhan971 commited on
Commit
8ec096e
·
verified ·
1 Parent(s): 2eb2516

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -7
Dockerfile CHANGED
@@ -1,8 +1,10 @@
 
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # System dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  libpoppler-cpp-dev \
@@ -11,24 +13,31 @@ RUN apt-get update && apt-get install -y \
11
  && apt-get clean \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Install groq explicitly first bypasses any stale cache
15
- RUN pip install --no-cache-dir groq
16
-
17
- # Copy and install remaining requirements
18
  COPY requirements.txt .
 
 
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
  # Copy all app files
22
  COPY . .
23
 
24
- # Writable dirs for PDF output and temp files
25
- RUN mkdir -p /app/tmp && chmod 777 /app/tmp && chmod 777 /app
 
26
 
 
27
  EXPOSE 7860
28
 
 
29
  ENV STREAMLIT_SERVER_PORT=7860
30
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
31
  ENV STREAMLIT_SERVER_HEADLESS=true
32
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
33
 
 
 
 
 
 
34
  CMD ["/bin/bash", "start.sh"]
 
1
+ # Use official Python slim image
2
  FROM python:3.10-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies needed for PDF generation
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  libpoppler-cpp-dev \
 
13
  && apt-get clean \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Copy requirements first (for Docker layer caching)
 
 
 
17
  COPY requirements.txt .
18
+
19
+ # Install Python dependencies
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
  # Copy all app files
23
  COPY . .
24
 
25
+ # Create a writable directory for temporary files and PDF output
26
+ RUN mkdir -p /app/tmp && chmod 777 /app/tmp
27
+ RUN chmod 777 /app
28
 
29
+ # Expose Streamlit default port
30
  EXPOSE 7860
31
 
32
+ # Set environment variables for Streamlit
33
  ENV STREAMLIT_SERVER_PORT=7860
34
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
35
  ENV STREAMLIT_SERVER_HEADLESS=true
36
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
37
 
38
+ # ✅ Fix for 403 file upload error on HF Spaces
39
+ ENV STREAMLIT_SERVER_ENABLE_CORS=false
40
+ ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
41
+
42
+ # Run the app via start.sh
43
  CMD ["/bin/bash", "start.sh"]