TxAgent-Api / Dockerfile
Ali2206's picture
Update Dockerfile
b0114f5 verified
raw
history blame
927 Bytes
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV HF_HOME=/data/hf_cache
ENV TRANSFORMERS_CACHE=/data/hf_cache/txagent_models
# Create and set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpoppler-cpp-dev \
pkg-config \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create necessary directories
RUN mkdir -p /data/hf_cache/txagent_models \
/data/hf_cache/tool_cache \
/data/hf_cache/cache \
/data/hf_cache/reports
# Copy the application code
COPY . .
# Expose the port the app runs on
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]