File size: 772 Bytes
0598ebe
 
 
a30fdbb
0598ebe
 
 
 
4c53429
0598ebe
02bde37
ac92fa4
 
4c53429
0598ebe
 
 
a30fdbb
0598ebe
4c53429
0598ebe
4c53429
0598ebe
 
4c53429
0598ebe
f404977
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM python:3.9
# Switch to root for system installations
USER root

# Install Tesseract and language data
RUN apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# Create user and set up environment
RUN useradd -m -u 1000 user
RUN mkdir -p /app/temp && chmod -R 777 /app/temp
RUN mkdir -p /app/temp && chmod -R 777 /app/uploads

RUN --mount=type=secret,id=Access_key,mode=0444,required=true \
 git clone $(cat /run/secrets/Access_key) /app
WORKDIR /app

# Switch to user for pip installations
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy application files
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]