From 33f01eb0df91692824889a8affc61b8c6873a5e6 Mon Sep 17 00:00:00 2001 From: Bernhard Frauendienst Date: Thu, 7 Sep 2023 21:43:55 +0200 Subject: [PATCH] Add Dockerfile Based on ComfyUI PR #530 Co-Authored-By: ZacharyACoon --- .dockerignore | 8 +++++ Dockerfile | 78 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 23 +++++++++++++ docker-compose.yaml | 21 ++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..827e02326 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.* +!.git +__pycache__/ +*.py[cod] +input +models +notebooks +output diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..d6b891068 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +# syntax=docker/dockerfile:1 + +ARG PYTHON_VERSION=3.12 + +FROM python:${PYTHON_VERSION}-slim + +ARG PYTORCH_INSTALL_ARGS="" +ARG EXTRA_ARGS="" +ARG USERNAME=comfyui +ARG USER_UID=1000 +ARG USER_GID=${USER_UID} + +# Fail fast on errors or unset variables +SHELL ["/bin/bash", "-eux", "-o", "pipefail", "-c"] + +RUN < [!NOTE] +> For building the CPU-only image, it is recommended that you add the --cpu flag to the EXTRA_ARGS build arg: +> +> ```shell +> docker build --build-arg PYTORCH_INSTALL_ARGS="--index-url https://download.pytorch.org/whl/cpu" --build-arg EXTRA_ARGS=--cpu . +> ``` + ### Others: #### Apple Mac silicon diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..858840fbe --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + comfyui: + user: "1000:1000" + build: . + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] + ports: + - "8188:8188" + volumes: + - "./models:/app/models" + - "./input:/app/input" + - "./temp:/app/output/temp" + - "./output:/app/output" + - "./user:/app/user" + - "./custom_venv:/app/custom_venv" + - "./custom_nodes:/app/custom_nodes"