Try-Space-Project / Dockerfile
feylur's picture
Update Dockerfile
ad99874 verified
# CPU-optimized base image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies (FIXED package names for newer Debian)
RUN apt-get update && apt-get install -y \
git \
wget \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
libgthread-2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first
COPY requirements.txt .
# Install Python dependencies in order (CPU versions)
RUN pip install --no-cache-dir numpy==1.26.4 && \
pip install --no-cache-dir scipy==1.11.4 && \
pip install --no-cache-dir scikit-learn==1.3.2 && \
pip install --no-cache-dir matplotlib==3.7.2 && \
pip install --no-cache-dir torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118 && \
pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Expose port
EXPOSE 7860
# Environment variables
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
# Set cache directory to writable location
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV HF_DATASETS_CACHE=/tmp/huggingface
# Run app
CMD ["python", "app.py"]