File size: 969 Bytes
d7a035d
 
8f78b88
 
 
 
 
d7a035d
 
 
 
8f78b88
fb75d64
8f78b88
 
fb75d64
c9b0961
c6ce80e
 
d7a035d
 
1d7df5f
d7a035d
8f78b88
d7a035d
8f78b88
 
 
 
d7a035d
8f78b88
 
fb75d64
c9b0961
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
# Use the CUDA 11.8 base image that we know works
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04

# Set up the environment
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# Install Python 3.10
RUN apt-get update && apt-get install -y \
    python3.10 python3-pip libgl1-mesa-glx \
    && rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app

# Set a writable cache directory
ENV HF_HOME=/app/cache
RUN mkdir -p /app/cache && chmod 777 /app/cache

# Install the exact, known-good version of PyTorch for CUDA 11.8
RUN pip3 install torch==2.1.2+cu118 torchvision==0.16.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118

# Copy and install the rest of the dependencies
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy your main application code
COPY main.py .

# Expose the port
EXPOSE 8000

# The command to start the Uvicorn server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]