TxAgent-Api / Dockerfile
Ali2206's picture
Update Dockerfile
5e32d01 verified
raw
history blame
1.2 kB
FROM nvidia/cuda:12.1.1-base-ubuntu22.04
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV HF_HOME=/data/hf_cache
ENV TRANSFORMERS_CACHE=/data/hf_cache/txagent_models
ENV MPLCONFIGDIR=/tmp/matplotlib
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-dev \
build-essential \
libpoppler-cpp-dev \
&& rm -rf /var/lib/apt/lists/*
# Create and set working directory
WORKDIR /app
# Install specific versions of PyTorch and vLLM with CUDA 12.1 support
RUN pip install --no-cache-dir \
torch==2.1.2+cu121 \
--extra-index-url https://download.pytorch.org/whl/cu121
RUN pip install --no-cache-dir vllm==0.3.0
# Create necessary directories
RUN mkdir -p /data/hf_cache/txagent_models \
/data/hf_cache/tool_cache \
/data/hf_cache/cache \
/data/hf_cache/reports \
/tmp/matplotlib
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Expose port
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]