slm-arena / Dockerfile
Bc-AI's picture
Create Dockerfile
ca5f069 verified
Raw
History Blame Contribute Delete
827 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for layer caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy app files
COPY app.py .
COPY index.html .
# Create cache directory for models
RUN mkdir -p /app/model_cache
# Set environment variables
ENV TRANSFORMERS_CACHE=/app/model_cache
ENV HF_HOME=/app/model_cache
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Expose port (HuggingFace Spaces uses 7860)
EXPOSE 7860
# Run with gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "300", "--workers", "1", "--threads", "2", "app:app"]