aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.env.example7
-rw-r--r--Dockerfile1
-rw-r--r--compose.yaml20
3 files changed, 28 insertions, 0 deletions
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..af9e26e
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,7 @@
+# Copy to .env (gitignored) and set your real host paths.
+IMGGEN_OUT=/path/to/output
+IMGGEN_CACHE=/path/to/model-cache
+# IMGGEN_PORT=8765
+# IMGGEN_MODEL=sdxl
+# IMGGEN_UID=1000
+# IMGGEN_GID=100
diff --git a/Dockerfile b/Dockerfile
index 222f7d2..0405557 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -46,6 +46,7 @@ RUN python3 -m pip install --break-system-packages \
# --- app ---
WORKDIR /app
COPY generate.py /app/generate.py
+COPY server.py /app/server.py
# Model cache lives here; mount a host volume at this path to avoid
# re-downloading ~7.5GB of weights on every container start.
diff --git a/compose.yaml b/compose.yaml
new file mode 100644
index 0000000..c0f7ba1
--- /dev/null
+++ b/compose.yaml
@@ -0,0 +1,20 @@
+services:
+ imggen:
+ build: .
+ image: imggen:local
+ user: "${IMGGEN_UID:-1000}:${IMGGEN_GID:-100}"
+ group_add:
+ - video # gid for /dev/dri/card* access as non-root
+ devices:
+ - /dev/dri
+ volumes:
+ - ${IMGGEN_OUT:-./out}:/out
+ - ${IMGGEN_CACHE:-./models}:/models
+ environment:
+ - HF_HOME=/models
+ - IMGGEN_MODEL=${IMGGEN_MODEL:-sdxl}
+ - IMGGEN_PORT=${IMGGEN_PORT:-8765}
+ ports:
+ - "127.0.0.1:${IMGGEN_PORT:-8765}:8765"
+ entrypoint: ["python3"]
+ command: ["server.py"]