rththr commited on
Commit
56b7379
·
verified ·
1 Parent(s): 5cfb198

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -0
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ # 1. Install system dependencies for OpenCV (Required by EasyOCR)
4
+ RUN apt-get update && apt-get install -y \
5
+ libgl1-mesa-glx \
6
+ && rm -rf /var/lib/apt/lists/*
7
+
8
+ # 2. Set up working directory
9
+ WORKDIR /code
10
+
11
+ # 3. Install Python dependencies
12
+ COPY ./requirements.txt /code/requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
14
+
15
+ # 4. Copy the application code
16
+ COPY . .
17
+
18
+ # 5. Create a non-root user (Security requirement for HF Spaces)
19
+ RUN useradd -m -u 1000 user
20
+ USER user
21
+ ENV HOME=/home/user \
22
+ PATH=/home/user/.local/bin:$PATH
23
+
24
+ # 6. Start the API on port 7860
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]