Kartikeyssj2 commited on
Commit
c033def
·
verified ·
1 Parent(s): 7c38b83

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -1,21 +1,24 @@
 
1
  FROM python:3.12.3-slim
2
 
 
3
  WORKDIR /app
4
 
 
5
  COPY requirements.txt .
6
 
7
- # INSTALL GIT AND PIP DEPENDENCIES
8
  RUN apt-get update \
9
- && apt-get install -y git \
10
  && pip install --upgrade pip \
11
  && pip install -r requirements.txt \
12
  && apt-get clean
13
 
14
- RUN pip install --upgrade pip \
15
- && pip install -r requirements.txt
16
-
17
  COPY . .
18
 
 
 
19
 
20
- # Use 4 worker processes to handle requests efficiently.
21
- CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "fast_api:app"]
 
1
+ # BASE IMAGE
2
  FROM python:3.12.3-slim
3
 
4
+ # SET WORKING DIRECTORY
5
  WORKDIR /app
6
 
7
+ # COPY REQUIREMENTS FILE
8
  COPY requirements.txt .
9
 
10
+ # INSTALL SYSTEM DEPENDENCIES AND UPGRADE PIP
11
  RUN apt-get update \
12
+ && apt-get install -y git build-essential libffi-dev libssl-dev python3-dev \
13
  && pip install --upgrade pip \
14
  && pip install -r requirements.txt \
15
  && apt-get clean
16
 
17
+ # COPY ALL CONTENTS OF THE CURRENT DIRECTORY
 
 
18
  COPY . .
19
 
20
+ # RUN THE PYTHON SCRIPT TO DOWNLOAD NECESSARY MODELS AND FILES
21
+ RUN python download_models.py
22
 
23
+ # USE 4 WORKER PROCESSES AND ENABLE LOGGING TO STDOUT
24
+ CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "fast_api:app", "--log-level", "info", "--access-logfile", "-", "--error-logfile", "-"]