v2
This commit is contained in:
parent
72dc22fa22
commit
56018e39f8
8 changed files with 89 additions and 1 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use nix
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.direnv
|
12
.taskfiles/docker/Taskfile.yaml
Normal file
12
.taskfiles/docker/Taskfile.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
build:
|
||||||
|
desc: Build docker container
|
||||||
|
cmds:
|
||||||
|
- docker build -f Dockerfile-chainguard -t comfyui .
|
||||||
|
run:
|
||||||
|
desc: Run docker container
|
||||||
|
cmds:
|
||||||
|
- docker run -it --entrypoint /bin/bash comfyui
|
39
Dockerfile-chainguard
Normal file
39
Dockerfile-chainguard
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Stage 1: Build
|
||||||
|
FROM chainguard/python:latest-dev AS builder
|
||||||
|
# 2.3.0-cuda12.1-cudnn8-runtime AS builder
|
||||||
|
# FROM cgr.dev/chainguard/pytorch-cuda12:latest AS builder
|
||||||
|
ARG TAG_VERSION=v0.0.2
|
||||||
|
USER root
|
||||||
|
ENV ROOT=/app
|
||||||
|
WORKDIR ${ROOT}
|
||||||
|
RUN mkdir -p /nonroot/.cache/pip
|
||||||
|
RUN --mount=type=cache,target=/nonroot/.cache/pip \
|
||||||
|
git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \
|
||||||
|
cd ${ROOT} && \
|
||||||
|
git checkout ${TAG_VERSION} && \
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . ${ROOT}
|
||||||
|
RUN chown -R nonroot.nonroot /app/
|
||||||
|
RUN chown -R nonroot.nonroot /nonroot/
|
||||||
|
RUN chmod u+x entrypoint.sh
|
||||||
|
|
||||||
|
# # Stage 2: Minimal Image
|
||||||
|
FROM cgr.dev/chainguard/pytorch-cuda12:latest
|
||||||
|
USER nonroot
|
||||||
|
|
||||||
|
ENV ROOT=/app
|
||||||
|
WORKDIR ${ROOT}
|
||||||
|
|
||||||
|
# RUN apk add python-${version}
|
||||||
|
ENV ROOT=/app
|
||||||
|
ENV NVIDIA_VISIBLE_DEVICES=all PYTHONPATH="${PYTHONPATH}:${ROOT}" CLI_ARGS="" PATH="${PATH}:${ROOT}"
|
||||||
|
|
||||||
|
# Copy the application from the builder stage
|
||||||
|
COPY --from=builder /app ${ROOT}
|
||||||
|
# And the pip cache
|
||||||
|
COPY --from=builder /nonroot /nonroot
|
||||||
|
|
||||||
|
EXPOSE 7860
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
CMD python -u main.py --listen --port 7860 ${CLI_ARGS}
|
14
README.md
Normal file
14
README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# README
|
||||||
|
|
||||||
|
## local dev
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -f Dockerfile-chainguard -t comfyui .
|
||||||
|
docker run -it --entrypoint /bin/bash comfyui
|
||||||
|
```
|
||||||
|
|
||||||
|
## remote dev
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -it --entrypoint /bin/bash jahanson/comfyui:latest
|
||||||
|
```
|
9
Taskfile.yaml
Normal file
9
Taskfile.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
includes:
|
||||||
|
docker: .taskfiles/docker
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default:
|
||||||
|
cmds: ["task -l"]
|
|
@ -6,7 +6,7 @@ mkdir -vp /data/config/comfy/custom_nodes
|
||||||
|
|
||||||
declare -A MOUNTS
|
declare -A MOUNTS
|
||||||
|
|
||||||
MOUNTS["/root/.cache"]="/data/.cache"
|
MOUNTS["/nonroot/.cache"]="/data/.cache"
|
||||||
MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
|
MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
|
||||||
MOUNTS["${ROOT}/output"]="/output/comfy"
|
MOUNTS["${ROOT}/output"]="/output/comfy"
|
||||||
|
|
||||||
|
|
12
shell.nix
Normal file
12
shell.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Shell for bootstrapping flake-enabled nix and home-manager
|
||||||
|
{pkgs ? import <nixpkgs> {}}:
|
||||||
|
pkgs.mkShell {
|
||||||
|
# Enable experimental features without having to specify the argument
|
||||||
|
NIX_CONFIG = "experimental-features = nix-command flakes";
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
lazydocker
|
||||||
|
pre-commit
|
||||||
|
go-task
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue