abubasith86 commited on
Commit
7c0a0ac
·
verified ·
1 Parent(s): 9a133dc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -46
Dockerfile CHANGED
@@ -1,44 +1,4 @@
1
- # # Use official Python slim image
2
- # FROM python:3.12-slim
3
-
4
- # # Set environment variables for HF Space
5
- # ENV PYTHONUNBUFFERED=1 \
6
- # PYTHONDONTWRITEBYTECODE=1 \
7
- # LANG=C.UTF-8 \
8
- # LC_ALL=C.UTF-8
9
-
10
- # # Install system dependencies
11
- # RUN apt-get update && apt-get install -y \
12
- # git \
13
- # build-essential \
14
- # wget \
15
- # curl \
16
- # && rm -rf /var/lib/apt/lists/*
17
-
18
- # # Create backend directory and temp storage with proper permissions
19
- # RUN mkdir -p /backend /temp \
20
- # && chmod -R 777 /backend /temp
21
-
22
- # # Set working directory
23
- # WORKDIR /backend
24
-
25
- # # Clone your GitHub repo first, then move to /backend
26
- # RUN git clone https://github.com/abubasith456/Ai-Knowledgebase.git \
27
- # && mv Ai-Knowledgebase/* /backend/ \
28
- # && rm -rf Ai-Knowledgebase
29
-
30
- # # Upgrade pip and install Python dependencies
31
- # RUN pip install --upgrade pip
32
- # RUN pip install -r requirements.txt
33
-
34
- # # Expose port (adjust if your app uses a different port)
35
- # EXPOSE 8000
36
-
37
- # # Command to run your app
38
- # CMD ["python", "main.py"]
39
-
40
-
41
- # Use a lightweight Python base image
42
  FROM python:3.13-slim AS builder
43
 
44
  # Install git so we can clone the repo
@@ -54,13 +14,13 @@ RUN git clone https://github.com/abubasith456/Ai-Knowledgebase.git .
54
  # Move into the 'backend' directory
55
  WORKDIR /app/backend
56
 
57
- # Create a temp directory for uploads/cache with full permissions
58
- RUN mkdir -p /temp && chmod -R 777 /temp
59
-
60
- # Set environment variable for EasyOCR cache
61
- ENV EASYOCR_CACHE=/temp/.EasyOCR
62
 
63
  # Install Python dependencies
64
  RUN pip install --no-cache-dir -r requirements.txt
65
 
 
 
 
66
  CMD ["python", "main.py"]
 
1
+ # Use a lightweight Python base image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  FROM python:3.13-slim AS builder
3
 
4
  # Install git so we can clone the repo
 
14
  # Move into the 'backend' directory
15
  WORKDIR /app/backend
16
 
17
+ # Give root full permissions to EasyOCR default cache
18
+ RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
 
 
 
19
 
20
  # Install Python dependencies
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Run as root so that EasyOCR can write to /.EasyOCR
24
+ USER root
25
+
26
  CMD ["python", "main.py"]