sksameermujahid commited on
Commit
d099a33
·
verified ·
1 Parent(s): bcc53b2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -31
Dockerfile CHANGED
@@ -1,31 +1,36 @@
1
- FROM python:3.9-slim
2
-
3
- # Install system dependencies
4
- RUN apt-get update && apt-get install -y \
5
- tesseract-ocr \
6
- tesseract-ocr-eng \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
- # Create a non-root user
10
- RUN useradd -m -u 1000 user
11
- USER user
12
- ENV PATH="/home/user/.local/bin:$PATH"
13
-
14
- # Set working directory
15
- WORKDIR /app
16
-
17
- # Copy requirements first to leverage Docker cache
18
- COPY --chown=user requirements.txt .
19
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
20
-
21
- # Download spaCy model
22
- RUN python -m spacy download en_core_web_md
23
-
24
- # Copy the rest of the application
25
- COPY --chown=user . .
26
-
27
- # Expose the port the app runs on
28
- EXPOSE 7860
29
-
30
- # Command to run the application
31
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "newapp:app"]
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ tesseract-ocr \
6
+ tesseract-ocr-eng \
7
+ libgl1-mesa-glx \
8
+ libglib2.0-0 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Create a non-root user
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV PATH="/home/user/.local/bin:$PATH"
15
+
16
+ # Set working directory
17
+ WORKDIR /app
18
+
19
+ # Copy requirements first to leverage Docker cache
20
+ COPY --chown=user requirements.txt .
21
+
22
+ # Install Python dependencies
23
+ RUN pip install --no-cache-dir --upgrade pip && \
24
+ pip install --no-cache-dir --user -r requirements.txt
25
+
26
+ # Download spaCy model
27
+ RUN python -m spacy download en_core_web_md
28
+
29
+ # Copy the rest of the application
30
+ COPY --chown=user . .
31
+
32
+ # Expose the port the app runs on
33
+ EXPOSE 7860
34
+
35
+ # Command to run the application
36
+ CMD ["uvicorn", "newapp:app", "--host", "0.0.0.0", "--port", "7860"]