File size: 1,383 Bytes
2db3804
bc6b7df
 
 
 
 
 
 
 
 
2db3804
 
bc6b7df
 
 
 
 
2db3804
bc6b7df
 
07b5a8b
 
bc6b7df
2db3804
bc6b7df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8f49d15
 
 
bc6b7df
2db3804
 
 
9b2678d
bc6b7df
2db3804
bba77ac
2db3804
 
 
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
55
56
57
58
59
60
61
62
63
# Base image with Python
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Environment variables
ENV PYTHONUNBUFFERED=1
ENV MODEL_DIR=/tmp/models/realvisxl_v4

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    wget \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy all project files
COPY . /app

# ✅ Create and open permissions for /tmp and cache dirs
RUN mkdir -p /tmp/hf_cache /tmp/models/realvisxl_v4 && chmod -R 777 /tmp /root /app

# --- Install Python dependencies ---
RUN pip install --no-cache-dir \
    annotated-types==0.7.0 \
    anyio==4.11.0 \
    certifi==2025.10.5 \
    click==8.3.0 \
    colorama==0.4.6 \
    fastapi==0.119.0 \
    h11==0.16.0 \
    httpcore==1.0.9 \
    httpx==0.28.1 \
    idna==3.11 \
    pydantic==2.12.2 \
    pydantic_core==2.41.4 \
    python-dotenv==1.1.1 \
    sniffio==1.3.1 \
    starlette==0.48.0 \
    typing_extensions==4.15.0 \
    typing-inspection==0.4.2 \
    uvicorn==0.37.0 \
    torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu \
    diffusers==0.30.3 \
    huggingface_hub==0.26.2 \
    accelerate==1.1.1 \
    safetensors==0.4.5 \
    pillow==10.4.0\
    transformers==4.44.2




# Expose the API port
EXPOSE 7860

# Start FastAPI (main.py is inside app/)
CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]