File size: 794 Bytes
4ef3090 b5e4830 259b0c5 4ef3090 6f7f6fd b5e4830 4ef3090 b5e4830 4ef3090 259b0c5 4ef3090 259b0c5 b5e4830 9a25e9a 4ef3090 b5e4830 8d98053 4ef3090 b5e4830 8d98053 6f7f6fd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# Base image
FROM python:3.10-slim
# Set env to avoid interactive prompts and ensure models cache to /tmp
ENV HF_HOME=/tmp \
XDG_CACHE_HOME=/tmp \
TRANSFORMERS_CACHE=/tmp \
PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libsm6 \
libxext6 \
libxrender-dev \
libglib2.0-0 \
libblas-dev \
liblapack-dev \
gfortran \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Expose port (for local or HF Spaces)
EXPOSE 7860
# Start the Flask app
CMD ["python", "app.py"] |