ParthSadaria commited on
Commit
ea2525e
·
verified ·
1 Parent(s): 0becfe3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -9
Dockerfile CHANGED
@@ -1,21 +1,23 @@
1
- # Use the official Python image as the base
 
2
  FROM python:3.10-slim
3
 
4
- # Set working dir
5
- WORKDIR /app
 
6
 
7
- # Copy & install deps
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Copy app files
12
  COPY . .
13
 
14
- # Expose the same port you run on
15
  EXPOSE 7860
16
 
17
- # Make sure PATH includes /app
18
- ENV PATH="/app:${PATH}"
 
 
 
19
 
20
- # Run FastAPI via Uvicorn on port 7860
21
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # syntax=docker/dockerfile:1
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"]