abubasith86 commited on
Commit
8cd9384
·
verified ·
1 Parent(s): fd72914

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -11
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Use a lightweight Python base image
2
- FROM python:3.13-slim AS builder
3
 
4
- # Install git only
5
  RUN apt-get update && apt-get install -y git --no-install-recommends \
6
  && rm -rf /var/lib/apt/lists/*
7
 
@@ -14,24 +14,25 @@ RUN git clone https://github.com/abubasith456/Ai-Knowledgebase.git .
14
  # Move into the 'backend' directory
15
  WORKDIR /app/backend
16
 
17
- # Create temp directory for uploads
18
  RUN mkdir -p /temp && chmod -R 777 /temp
19
-
20
- # Create EasyOCR cache directory
21
  RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
22
-
23
- # Create Hugging Face cache directory
24
  RUN mkdir -p /.cache && chmod -R 777 /.cache
 
 
 
 
 
25
 
26
  # Install Python requirements
27
  RUN pip install -r requirements.txt
28
 
29
- # Install Playwright dependencies and browsers
30
  RUN playwright install-deps
31
- RUN playwright install
32
 
33
- # Run as root so that all cache dirs are writable
34
- USER root
35
 
36
  # Start your app
37
  CMD ["python", "main.py"]
 
1
  # Use a lightweight Python base image
2
+ FROM python:3.13-slim
3
 
4
+ # Install git and basic dependencies
5
  RUN apt-get update && apt-get install -y git --no-install-recommends \
6
  && rm -rf /var/lib/apt/lists/*
7
 
 
14
  # Move into the 'backend' directory
15
  WORKDIR /app/backend
16
 
17
+ # Create directories with proper permissions
18
  RUN mkdir -p /temp && chmod -R 777 /temp
 
 
19
  RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
 
 
20
  RUN mkdir -p /.cache && chmod -R 777 /.cache
21
+ RUN mkdir -p /.cache/ms-playwright && chmod -R 777 /.cache/ms-playwright
22
+
23
+ # Set environment variables for Playwright
24
+ ENV PLAYWRIGHT_BROWSERS_PATH=/.cache/ms-playwright
25
+ ENV PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
26
 
27
  # Install Python requirements
28
  RUN pip install -r requirements.txt
29
 
30
+ # Install Playwright dependencies and browsers as ROOT
31
  RUN playwright install-deps
32
+ RUN playwright install chromium
33
 
34
+ # Verify installation
35
+ RUN ls -la /.cache/ms-playwright/ || echo "Playwright cache not found"
36
 
37
  # Start your app
38
  CMD ["python", "main.py"]