Add swarmui

This commit is contained in:
fapoverflow 2025-07-31 02:12:04 +02:00
parent b4941ea474
commit 68afd2b968
5 changed files with 124 additions and 25 deletions

8
data/.gitignore vendored
View file

@ -1,6 +1,2 @@
/.cache
/config
/embeddings
/models
/states
/convert
/*
!/.gitignore

View file

@ -1,9 +1,7 @@
x-base_service: &base_service
volumes:
- &v1 ./data:/data
- &v2 ./output:/output
stop_signal: SIGKILL
tty: true
restart: unless-stopped
deploy:
resources:
# limits:
@ -17,6 +15,17 @@ x-base_service: &base_service
device_ids: ['0']
capabilities: [compute, utility, gpu]
x-auto_service: &auto_service
<<: *base_service
container_name: auto
build: ./services/AUTOMATIC1111
image: sd-auto:78
ports:
- "${WEBUI_PORT:-7860}:7860"
volumes:
- &v1 ./data:/data
- &v2 ./output:/output
name: webui-docker
services:
@ -26,18 +35,14 @@ services:
volumes:
- *v1
auto: &automatic
<<: *base_service
auto:
<<: *auto_service
profiles: ["auto"]
build: ./services/AUTOMATIC1111
image: sd-auto:78
ports:
- "${WEBUI_PORT:-7860}:7860"
environment:
- CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api
auto-cpu:
<<: *automatic
<<: *auto_service
profiles: ["auto-cpu"]
deploy: {}
ports:
@ -45,10 +50,17 @@ services:
environment:
- CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api
auto-full:
<<: *auto_service
profiles: [ "full" ]
environment:
- CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --no-half-vae --api
comfy: &comfy
<<: *base_service
profiles: ["comfy"]
build: ./services/comfy/
container_name: comfy
build: ./services/comfy
image: sd-comfy:7
volumes:
- ./data/models:/opt/comfyui/models
@ -72,15 +84,19 @@ services:
environment:
- CLI_ARGS=--cpu
auto-full:
swarmui:
<<: *base_service
profiles: [ "full" ]
build: ./services/AUTOMATIC1111
image: sd-auto:78
environment:
- CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api
profiles: ["swarmui"]
container_name: swarmui
build: ./services/swarmui
image: sd-swarmui
ports:
- "${WEBUI_PORT:-7860}:7860"
- "${SWARMUI_PORT:-7801}:7801"
volumes:
- ./data/swarmui:/SwarmUI/Data
# - "backend:/app/dlbackend"
- ./data/models:/SwarmUI/Models
- ./output/swarmui:/SwarmUI/Output
convertor:
<<: *base_service

View file

@ -2,5 +2,4 @@
set -ex
echo "Running container as $USER"
echo "Running container as $USER..."
python convert_2_safetensors.py --source ./models/input --dest ./models/output --allow-pickle

View file

@ -0,0 +1,68 @@
ARG SWARMUI_VERSION=0.9.6-Beta
ARG DOTNET_VERSION=8.0-bookworm-slim
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV SWARM_PATH="/SwarmUI"
#ENV SWARM_PATH=/opt/swarmui
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && \
apt-get install -y git
WORKDIR ${SWARM_PATH}
# Clones the SwarmUI repository and checks out the latest release
RUN git clone --depth=1 https://github.com/mcmonkeyprojects/SwarmUI.git ${SWARM_PATH} && \
cd ${SWARM_PATH} && \
git fetch origin ${SWARMUI_VERSION} && \
git checkout FETCH_HEAD
RUN dotnet build src/SwarmUI.csproj --configuration Release -o ./bin
# RUN
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV SWARM_PATH="/SwarmUI"
#ENV SWARM_PATH=/opt/swarmui
ARG SWARMUI_USER_ID=1000
ARG SWARMUI_GROUP_ID=1000
ARG GPU_TYPE="nv"
ENV NVIDIA_VISIBLE_DEVICES=all
ENV CLI_ARGS=""
RUN addgroup --gid $SWARMUI_GROUP_ID swarmui && \
adduser --uid $SWARMUI_USER_ID --gid $SWARMUI_GROUP_ID --gecos "" --disabled-password swarmui
COPY --from=build ${SWARM_PATH} "${SWARM_PATH}/"
RUN mkdir -p "${SWARM_PATH}/Data" && \
chown -R swarmui:swarmui ${SWARM_PATH}
ENV HOME=${SWARM_PATH}
RUN --mount=type=cache,target=/var/cache/apt \
apt update --assume-yes && \
apt install -y \
git \
wget \
build-essential \
python3.11 \
python3.11-venv \
python3.11-dev \
python3-pip \
ffmpeg \
libglib2.0-0 \
libgl1
WORKDIR ${SWARM_PATH}
USER swarmui
RUN chmod +x ${SWARM_PATH}/launchtools/comfy-install-linux.sh && \
${SWARM_PATH}/launchtools/comfy-install-linux.sh ${GPU_TYPE}
EXPOSE 7801
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh", "--launch_mode", "none", "--host", "0.0.0.0"]

View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Ensure correct local path.
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$SCRIPT_DIR"
# Add dotnet non-admin-install to path
export PATH="$SCRIPT_DIR/.dotnet:~/.dotnet:$PATH"
# Default env configuration, gets overwritten by the C# code's settings handler
export ASPNETCORE_ENVIRONMENT="Production"
export ASPNETCORE_URLS="http://*:7801"
# Actual runner.
cd "$HOME"
dotnet ./bin/SwarmUI.dll "$@"
# Exit code 42 means restart, anything else = don't.
if [ $? == 42 ]; then
. /entrypoint.sh "$@"
fi