File size: 1,469 Bytes
6358317
 
286d36e
 
 
 
6358317
55f3427
6358317
 
 
55f3427
286d36e
f3ad87e
6358317
 
 
 
 
 
 
 
 
 
 
 
f3ad87e
 
 
 
 
 
 
 
6358317
 
 
 
82a39f9
2c5974f
82a39f9
286d36e
 
 
 
 
 
 
 
 
 
 
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
# Use NVIDIA CUDA base image for GPU support
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

# Set working directory
WORKDIR /app

# Install Python 3.11 and necessary tools
RUN apt-get update --fix-missing && apt-get install -y --no-install-recommends \
    python3.11 \
    python3.11-dev \
    python3-pip \
    git \
    gcc \
    build-essential \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/* \
    && ln -sf /usr/bin/python3.11 /usr/bin/python3 \
    && ln -sf /usr/bin/python3.11 /usr/bin/python

# Set Hugging Face cache directory
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV HF_HOME=/app/.cache/huggingface
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface

# Copy requirements file
COPY requirements.txt .

# Update pip and install pip-tools
RUN pip install --no-cache-dir --upgrade pip \
    && pip install --no-cache-dir pip-tools

# Sync dependencies with pip-sync
RUN pip-sync requirements.txt

# Install Gradio, diffusers, and LoRA packages
RUN pip install --no-cache-dir gradio==4.44.0
RUN pip install --no-cache-dir diffusers==0.30.3
RUN pip install --no-cache-dir huggingface_hub==0.25.2
RUN pip install git+https://github.com/cloneofsimo/lora.git
RUN pip install git+https://github.com/microsoft/LoRA

# Copy the rest of the application code
COPY . .

# Expose Gradio default port
EXPOSE 7860

# Set environment variable to prevent Python buffering
ENV PYTHONUNBUFFERED=1

# Run the Gradio app
CMD ["python", "app.py"]