-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (25 loc) · 863 Bytes
/
Dockerfile
File metadata and controls
35 lines (25 loc) · 863 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
25
26
27
28
29
30
31
32
33
34
35
# Use the official Python image as the base image
FROM python:3.11-slim
# Set the working directory in the container
WORKDIR /app
# Install essential packages
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file to the container
COPY requirements.txt .
# Install CPU-only Torch FIRST
RUN pip install --upgrade pip && \
pip install --no-cache-dir torch==2.2.2+cpu --index-url https://download.pytorch.org/whl/cpu
# Install the remaining dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the FastAPI application code to the container
COPY . .
# Expose the port that FastAPI will run on
EXPOSE 8000
# Make the Entrypoint executable
RUN chmod +x entrypoint.sh
ENV PYTHONUNBUFFERED=1
# Execute the Entrypoint script
ENTRYPOINT ["./entrypoint.sh"]