AI_Avatar_Chat / Dockerfile
bravedims
Fix Docker build error by removing problematic dependencies
1be0a9c
raw
history blame
1.59 kB
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# Use NVIDIA PyTorch base image for GPU support
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel
# Set timezone to prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Create user as required by HF Spaces
RUN useradd -m -u 1000 user
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
curl \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libgoogle-perftools4 \
libtcmalloc-minimal4 \
ffmpeg \
tzdata \
git-lfs \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Switch to user
USER user
# Set environment variables for user
ENV PATH="/home/user/.local/bin:$PATH"
ENV PYTHONPATH=/app
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
ENV HF_HOME=/tmp/hf_cache
ENV TRANSFORMERS_CACHE=/tmp/hf_cache
ENV HF_HUB_CACHE=/tmp/hf_cache
# Set working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . /app
# Create necessary directories
RUN mkdir -p pretrained_models outputs /tmp/hf_cache
# Make scripts executable
RUN chmod +x download_models.sh start.sh
# Expose port (required by HF Spaces to be 7860)
EXPOSE 7860
# Start the application using startup script
CMD ["./start.sh"]