aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: 222f7d2268dc1c0f0e4d1def8d6fd5839b15d625 (plain)
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
# Copyright (C) 2026 Danilo
# Licensed under the GNU General Public License version 2.
#
# Local SDXL image generation on Intel Arc B580 under Slackware, via a
# container that carries the Intel Level Zero runtime the host distro lacks.
#
# Base image: intel/oneapi-basekit ships the Level Zero loader + compute
# runtime that make torch.xpu see the GPU. This is the piece Slackware does
# not package, and the reason the whole approach is containerized rather
# than native.
#
# IMPORTANT - version pinning:
# The tags below are placeholders you MUST replace with the EXACT versions
# that worked in your test session. XPU-for-diffusion is a young, fast-moving
# stack (IPEX was retired in 2026); an unpinned rebuild can silently break a
# working setup. Capture your real versions with:
#     python3 -m pip freeze | grep -Ei 'torch|diffusers|transformers|accelerate|huggingface|numpy|pillow|safetensors'
# then paste them into the pip install line below, replacing the loose names.

# Confirmed from the working container: oneAPI 2025.3, Ubuntu 24.04.4 Noble.
# If this exact tag is not on Docker Hub, pick the closest oneapi-basekit tag
# whose oneAPI version is 2025.3.x and record what you used. Do NOT use :latest.
FROM intel/oneapi-basekit:2025.3.2-0-devel-ubuntu24.04

# --- system python + pip (base image ships python3 but not pip) ---
RUN apt-get update \
    && apt-get install -y --no-install-recommends python3-pip python3-venv \
    && rm -rf /var/lib/apt/lists/*

# --- python deps (PINNED to the confirmed working environment) ---
# torch from the Intel XPU wheel index; everything else from PyPI.
# These are the exact versions that produced ~6.3s warm SDXL-base images
# with peak VRAM 9.07 GB on an Arc B580. Do not bump casually.
RUN python3 -m pip install --break-system-packages \
        --index-url https://download.pytorch.org/whl/xpu \
        torch==2.12.1+xpu \
    && python3 -m pip install --break-system-packages \
        diffusers==0.39.0 \
        transformers==5.13.0 \
        accelerate==1.14.0 \
        safetensors==0.8.0 \
        huggingface_hub==1.22.0 \
        numpy==2.5.1 \
        pillow==12.3.0

# --- app ---
WORKDIR /app
COPY generate.py /app/generate.py

# Model cache lives here; mount a host volume at this path to avoid
# re-downloading ~7.5GB of weights on every container start.
ENV HF_HOME=/models

ENTRYPOINT ["python3", "/app/generate.py"]