-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (18 loc) · 731 Bytes
/
Copy pathDockerfile
File metadata and controls
24 lines (18 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Base image: Python 3.9 slim version to save space
FROM python:3.9-slim
# Set working directory inside the container
WORKDIR /app
# Copy requirements file first (for caching layers)
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir --upgrade pip
# This avoid to install GPU version of torch that is large in size
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# We use --no-cache-dir to keep image small
RUN pip install --no-cache-dir -r requirements.txt
# Copy the source code
COPY src/ ./src/
# Expose the port FastAPI runs on
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7860"]