aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..222f7d2
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,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"]