aiapp / Dockerfile
abdullahalioo's picture
Update Dockerfile
f6ba75c verified
raw
history blame
791 Bytes
FROM nvidia/cuda:12.1.1-base-ubuntu22.04
# 1. Install system dependencies properly
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
python3.10-venv \
git \
&& rm -rf /var/lib/apt/lists/*
# 2. Create and activate virtual environment
RUN python3.10 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# 3. Set cache directories (writable locations)
ENV TRANSFORMERS_CACHE=/app/model_cache \
HF_HOME=/app/huggingface \
XDG_CACHE_HOME=/app/cache
WORKDIR /app
# 4. Install requirements FIRST (better layer caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Copy app code
COPY . .
# 6. Explicitly use the virtualenv's uvicorn
CMD ["/opt/venv/bin/uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]