File size: 1,061 Bytes
75678ac
b99ef36
 
75678ac
b99ef36
 
232c3a7
 
 
 
 
 
 
7c0db33
 
cc8d20a
232c3a7
7c0db33
 
cc8d20a
232c3a7
b99ef36
 
 
cc8d20a
93b1fdc
b99ef36
7c0db33
93b1fdc
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
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /code

# --- FINAL FIX: Install system-level build tools ---
# The 'slim' python image is minimal. Libraries like bitsandbytes and peft
# need a C compiler (gcc) and other tools to build custom CUDA kernels.
# 'build-essential' installs these required tools via the system package manager.
RUN apt-get update && apt-get install -y build-essential

# Create a writeable directory for caching models and other artifacts.
RUN mkdir -p /code/data/.cache && \
    chmod -R 777 /code/data

# Redirect all cache directories to our writeable location.
ENV HF_HOME="/code/data/.cache"
ENV TRITON_CACHE_DIR="/code/data/.triton"

# Copy and install all required python libraries
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the main application file
COPY ./app.py /code/app.py

# Command to run the app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]