File size: 782 Bytes
9fe7214 e1e1849 9fe7214 0026995 bd5e921 e1e1849 bd5e921 e1e1849 9fe7214 2d90eac 6bdcfba c148c64 6bdcfba 9fe7214 e1e1849 50947d9 9fe7214 e505dc9 ffd1cb6 e505dc9 50947d9 9fe7214 e1e1849 9fe7214 d84a68c e1e1849 e505dc9 ffd1cb6 |
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 |
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install PyTorch with CPU-specific index
RUN pip install --no-cache-dir torch==2.4.0 --index-url https://download.pytorch.org/whl/cpu
# Install remaining dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create cache directory with write permissions
RUN mkdir -p /app/cache/hub && chmod -R 777 /app/cache
# Copy application code
COPY app.py .
# Set environment variables
ENV HF_HOME=/app/cache
ENV NUMBA_CACHE_DIR=/app/cache
# Expose port
EXPOSE 7860
# Run FastAPI with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |