File size: 1,330 Bytes
a932168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Dockerfile.gpu - GPU deployment for DIA
# --------------------------------------------------
# Build: docker build . -f docker/Dockerfile.gpu -t dia-gpu
# Run:   docker run --rm --gpus all -p 7860:7860 dia-gpu
# Requires NVIDIA Container Toolkit on host.

FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime

# Set non-interactive frontend
ENV DEBIAN_FRONTEND=noninteractive

# Install venv, and system dependencies
RUN apt-get update && apt-get install -y \
    python3-venv \
    libsndfile1 \
    ffmpeg \
    curl \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Create non-root user and set up directories
RUN useradd -m -u 1001 appuser && \
    mkdir -p /app/outputs /app && \
    chown -R appuser:appuser /app

USER appuser
WORKDIR /app

# Copy all code (including pyproject.toml)
COPY --chown=appuser:appuser . .

# Create and activate virtual environment
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"

# Install all project dependencies
RUN pip install --upgrade pip && pip install --no-cache-dir .

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONPATH=/app \
    USE_GPU=true \
    LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda-12.1/lib64:${LD_LIBRARY_PATH}

# Expose Gradio default port
ENV GRADIO_SERVER_NAME="0.0.0.0"
EXPOSE 7860

# Entrypoint
CMD ["python3", "app.py"]