sidmaz666 commited on
Commit
057363e
·
verified ·
1 Parent(s): 3b8610c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -10
Dockerfile CHANGED
@@ -1,10 +1,10 @@
1
- # Use a slim Python base image for efficiency
2
  FROM python:3.11-slim
3
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies including git for cloning the model repo
8
  RUN apt-get update && apt-get install -y \
9
  libgomp1 \
10
  libglib2.0-0 \
@@ -12,20 +12,20 @@ RUN apt-get update && apt-get install -y \
12
  wget \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Copy the requirements file first for better caching
16
  COPY requirements.txt .
17
 
18
  # Install Python dependencies
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
- # Create a directory for models and clone the OpenVINO model from Hugging Face
22
- RUN mkdir -p /app/models && \
23
- git clone https://huggingface.co/rupeshs/LCM-dreamshaper-v7-openvino /app/models/LCM-dreamshaper-v7-openvino && \
24
- # Create a dedicated directory for LoRAs
25
- mkdir -p /app/models/loras
26
 
27
- # Set environment variable to point to the local model path
28
- ENV OV_MODEL_PATH="/app/models/LCM-dreamshaper-v7-openvino"
 
 
 
29
 
30
  # Copy the application code
31
  COPY app.py .
 
1
+ # Use a slim Python base image
2
  FROM python:3.11-slim
3
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  libgomp1 \
10
  libglib2.0-0 \
 
12
  wget \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Copy requirements first for better caching
16
  COPY requirements.txt .
17
 
18
  # Install Python dependencies
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Create directories for models
22
+ RUN mkdir -p /app/models/loras
 
 
 
23
 
24
+ # Pre-download the PyTorch LCM model during build
25
+ RUN python -c "from diffusers import DiffusionPipeline; \
26
+ pipe = DiffusionPipeline.from_pretrained('SimianLuo/LCM_Dreamshaper_v7', \
27
+ torch_dtype=torch.float32, safety_checker=None); \
28
+ pipe.to('cpu')"
29
 
30
  # Copy the application code
31
  COPY app.py .