ParthSadaria commited on
Commit
e2d9c95
·
verified ·
1 Parent(s): 019fabf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -5
Dockerfile CHANGED
@@ -2,22 +2,31 @@
2
 
3
  FROM python:3.10-slim
4
 
5
- # install tini for proper signal forwarding
6
- RUN apt-get update && apt-get install -y --no-install-recommends tini \
 
 
7
  && rm -rf /var/lib/apt/lists/*
8
 
 
9
  WORKDIR /app
 
 
10
  COPY requirements.txt .
11
- RUN pip install --no-cache-dir -r requirements.txt
 
12
 
 
13
  COPY . .
14
 
 
15
  EXPOSE 7860
16
 
17
- # use tini as PID 1 so SIGTERM/SIGINT get forwarded
18
  ENTRYPOINT ["/usr/bin/tini", "--"]
19
 
20
- # default is SIGTERM, but you can override:
21
  STOPSIGNAL SIGTERM
22
 
 
23
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  FROM python:3.10-slim
4
 
5
+ # install tini and system deps
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ tini build-essential \
8
+ && apt-get clean \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # set workdir
12
  WORKDIR /app
13
+
14
+ # install python deps first (layer caching)
15
  COPY requirements.txt .
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -r requirements.txt
18
 
19
+ # copy app code
20
  COPY . .
21
 
22
+ # expose port
23
  EXPOSE 7860
24
 
25
+ # use tini to forward signals correctly (prevents zombie processes)
26
  ENTRYPOINT ["/usr/bin/tini", "--"]
27
 
28
+ # optional: default stop signal
29
  STOPSIGNAL SIGTERM
30
 
31
+ # start the app
32
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]