FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
ARG SWARM_REV=de7b834b4aabc6b0239acb76940833277445fe51
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/mcmonkeyprojects/SwarmUI.git /swarm && git -C /swarm checkout ${SWARM_REV}
WORKDIR /swarm
# No local llama inference backend packages in this frontend-only image.
RUN sed -i '/LLamaSharp.Backend.Cpu/d; /LLamaSharp.Backend.Cuda12/d' src/SwarmUI.deps.props
COPY patch-source.py /tmp/patch-source.py
RUN apt-get update && apt-get install -y --no-install-recommends python3 && python3 /tmp/patch-source.py
RUN dotnet build src/SwarmUI.csproj -c Release -o src/bin/live_release
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends python3 ffmpeg git ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=build /swarm /swarm
COPY proxy.py entrypoint.py /integration/
WORKDIR /swarm
ENV SWARM_PORT=8125 SWARM_PROXY_PORT=8126 SWARM_DECK_PORT=8120
USER 65534:65534
ENTRYPOINT ["python3","/integration/entrypoint.py"]
