ZeroTraceX commited on
Commit
0598ebe
·
verified ·
1 Parent(s): a30fdbb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -24
Dockerfile CHANGED
@@ -1,32 +1,27 @@
1
- # Use Python 3.10 slim image as base
2
- FROM python:3.10-slim
3
 
4
- # Create non-root user
5
- RUN useradd -m -u 1000 user
6
- RUN apt-get update && apt-get install -y git
7
 
8
- # Set environment variables
9
- ENV HOME=/home/user \
10
- PATH=/home/user/.local/bin:$PATH \
11
- PORT=7860
12
 
13
- # Create and set working directory
14
- WORKDIR $HOME/app
 
15
 
16
- # Clone the repository and move files without creating an extra folder
17
- RUN git clone https://github.com/charan200415/FileToLink temp && \
18
- shopt -s dotglob && \
19
- mv temp/* ./ && \
20
- rmdir temp
21
 
22
- # Switch to non-root user
23
  USER user
 
24
 
25
- # Install dependencies
26
- RUN pip install --user -r requirements.txt
27
 
28
- # Expose port
29
- EXPOSE ${PORT}
30
-
31
- # Command to run the application
32
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
 
1
+ FROM python:3.9
 
2
 
3
+ # Switch to root for system installations
4
+ USER root
 
5
 
6
+ # Install Tesseract and language data
7
+ RUN apt-get update && apt-get install -y \
8
+ git \
9
+ && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Create user and set up environment
12
+ RUN useradd -m -u 1000 user && \
13
+ chown -R user:user /usr/share/tesseract-ocr/4.00/tessdata
14
 
15
+ RUN --mount=type=secret,id=Access_key,mode=0444,required=true \
16
+ git clone $(cat /run/secrets/Access_key) /app
17
+ WORKDIR /app
 
 
18
 
19
+ # Switch to user for pip installations
20
  USER user
21
+ ENV PATH="/home/user/.local/bin:$PATH"
22
 
23
+ # Install Python dependencies
24
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
25
 
26
+ # Copy application files
27
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "--workers", "2", "--threads", "4", "app:app"]