File size: 1,049 Bytes
c26b6eb
f959360
c26b6eb
 
 
 
f574b59
c26b6eb
 
 
f574b59
c26b6eb
f959360
 
c26b6eb
f959360
 
c26b6eb
 
 
 
 
f959360
c26b6eb
 
f959360
c26b6eb
f959360
c26b6eb
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Dockerfile

# 1. Choose a base Python image
#    Using a specific version is recommended for reproducibility.
#    The '-slim' variant is smaller.
FROM python:3.12-slim

# 2. Set environment variables (optional but good practice)
ENV PYTHONDONTWRITEBYTECODE 1 
ENV PYTHONUNBUFFERED 1       

# 3. Set the working directory inside the container
WORKDIR /app

# 4. Copy only the requirements file first to leverage Docker cache
COPY requirements.txt .

# 5. Install dependencies
#    --no-cache-dir makes the image smaller
#    --upgrade pip ensures we have the latest pip
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# 6. Copy the rest of the application code into the working directory
COPY . .

# 7. Expose the port the app runs on (uvicorn default is 8000)
EXPOSE 8000

# 8. Define the default command to run when the container starts
#    Use exec form for proper signal handling.
#    Do NOT use --reload in production.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]