Spaces:
Build error
Build error
File size: 1,292 Bytes
fa2f0d0 25332d7 fa2f0d0 e0bcc17 fa2f0d0 e0bcc17 fa2f0d0 e0bcc17 25332d7 fa2f0d0 e0bcc17 |
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime
ENV GRADIO_SERVER_PORT=7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV HF_HOME=/app/.cache/huggingface
# Install required system libraries
RUN apt-get update && apt-get install -y \
git \
build-essential \
gfortran \
libopenblas-dev \
liblapack-dev \
libatlas-base-dev \
libjpeg-dev \
libpng-dev \
libffi-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Create mount point and set permissions for persistent storage
RUN mkdir -p /mnt && \
chown -R 1000:1000 /mnt && \
chmod 755 /mnt
VOLUME /mnt
WORKDIR /opt/app
# Copy requirements first for better caching
COPY requirements.txt requirements.txt
# Upgrade pip & install Python dependencies
RUN pip install --upgrade pip setuptools wheel && \
pip install -r requirements.txt
# Create non-root user for better security
RUN useradd -m -u 1000 appuser && \
mkdir -p /app/.cache/huggingface && \
mkdir -p /tmp/gradio_cache && \
mkdir -p /app/temp_audio && \
chown -R appuser:appuser /app && \
chown -R appuser:appuser /tmp/gradio_cache
USER appuser
# Copy application files
COPY app.py .
COPY public/ /opt/app/public/
# Run Gradio app
CMD ["python", "app.py"]
|