File size: 2,055 Bytes
736cf48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cd0310f
4f0eee1
cd0310f
c9b2c0d
00c018e
 
 
736cf48
c9b2c0d
736cf48
 
 
 
b7cce06
736cf48
 
 
 
 
 
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
FROM ubuntu:22.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential cmake git ca-certificates libopenblas-dev pkg-config \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /build

RUN git clone --depth 1 https://github.com/leejet/stable-diffusion.cpp.git . \
    && git submodule update --init --depth 1

RUN mkdir build && cd build \
    && cmake .. -DGGML_BLAS=ON -DSD_BUILD_SHARED_LIBS=OFF \
    && cmake --build . --config Release -j1

RUN mkdir -p /artifacts \
    && cp /build/build/bin/sd-cli /artifacts/ \
    && (cp -a /build/build/bin/lib*.so* /artifacts/ 2>/dev/null || true)

# ---------------------------------------------------------------------------
# Runtime image
# ---------------------------------------------------------------------------
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
    libopenblas0 libgomp1 ca-certificates curl \
    python3 python3-pip \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=builder /artifacts/ /app/
ENV LD_LIBRARY_PATH=/app:${LD_LIBRARY_PATH}
RUN chmod +x /app/sd-cli

RUN mkdir -p /app/models

# Z-Anime distill 4-step Q5_0 GGUF (~4.23GB) - converted by WeReCooking
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/z-anime-distill-4step-q5_0.gguf \
    "https://huggingface.co/WeReCooking/Z-Anime-4step-GGUF/resolve/main/z-anime-distill-4step-q5_0.gguf"

# Qwen3-4B text encoder IQ4_XS GGUF (~2.29GB) - smaller for 18GB RAM
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/qwen3_4b_iq4xs.gguf \
    "https://huggingface.co/worstplayer/Z-Image_Qwen_3_4b_text_encoder_GGUF/resolve/main/Qwen_3_4b-IQ4_XS.gguf"

# VAE (~168MB)
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/ae.safetensors \
    "https://huggingface.co/SeeSee21/Z-Anime/resolve/main/vae/ae.safetensors"

# Install Python deps
RUN pip3 install --no-cache-dir "gradio[mcp]" Pillow

COPY app.py /app/app.py

EXPOSE 7860

CMD ["python3", "/app/app.py"]