attention_surgery / Dockerfile
ludaladila
upodat
f596036
raw
history blame contribute delete
832 Bytes
# Use Python 3.10 Slim image
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY attention_surgery/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install uvicorn fastapi python-multipart
# Copy Backend Code
COPY attention_surgery/ ./attention_surgery/
# Set Python Path
ENV PYTHONPATH=/app
# Create cache directory for Hugging Face models with correct permissions
RUN mkdir -p /app/cache && chmod 777 /app/cache
ENV TRANSFORMERS_CACHE=/app/cache
ENV HF_HOME=/app/cache
# Expose port 7860 (Hugging Face default)
EXPOSE 7860
# Run command
CMD ["uvicorn", "attention_surgery.api:app", "--host", "0.0.0.0", "--port", "7860"]