File size: 1,377 Bytes
7417c4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7087aed
7417c4f
 
 
 
 
 
 
 
 
 
 
7087aed
7417c4f
 
7087aed
7417c4f
 
 
 
 
 
 
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
# Start from NVIDIA CUDA base image
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV TORCH_HOME=/app/models

# Install system dependencies
RUN apt-get update && apt-get install -y \
    python3.10 \
    python3-pip \
    git \
    libgl1-mesa-glx \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip3 install --no-cache-dir torch==2.4.0+cu121 torchvision==0.19.1+cu121 --index-url https://download.pytorch.org/whl/cu121
RUN pip3 install --no-cache-dir -r requirements.txt

# Create models directory
RUN mkdir -p /app/models /app/outputs

# Copy application files
COPY . .

# Download model weights if needed
RUN mkdir -p /app/models && \
    if [ ! -f /app/models/iclight_sd15_fc.safetensors ]; then \
    wget -P /app/models https://huggingface.co/lllyasviel/ic-light/resolve/main/iclight_sd15_fc.safetensors; \
    fi && \
    if [ ! -f /app/models/iclight_sd15_fbc.safetensors ]; then \
    wget -P /app/models https://huggingface.co/lllyasviel/ic-light/resolve/main/iclight_sd15_fbc.safetensors; \
    fi

# Expose port for Gradio
EXPOSE 7860

# Command to run the application
CMD ["python3", "gradio_demo.py"]