ControlNet-v1-1-nightly
ControlNet-v1-1-nightly copied to clipboard
[Feature Request] Docker / Compose ?
What about providing a docker image w/ compose ? If you don't have one I can open a PR, what combo of pytorch / cuda / python would you suggest ?
Amazing work folks, keep it up and thanks regardless of this 🎸
What about this combo that automatically starts a gradio interface at docker compose up
?
Just replace /app/<GRADIO_IFACE>.py
with your preferred interface, an add server_port=5000
to your interfaces
Dockerfile
FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime
# Set working directory
WORKDIR /app
# Copy environment.yml file
COPY environment.yaml .
# Install conda, create a conda environment, and install dependencies
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y build-essential
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN chmod -v +x Miniconda3-latest-Linux-x86_64.sh
RUN rm -rf /opt/newconda
RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/newconda
RUN /opt/newconda/bin/conda env create -f environment.yaml
RUN /opt/newconda/bin/conda clean -a -y
RUN apt-get install -y libglib2.0-0
RUN apt-get install -y libsm6 libxext6
RUN apt-get install -y libxrender-dev
# Activate the conda environment and run the python script
RUN mkdir /scripts
RUN echo "source /opt/newconda/bin/activate control-v11 && python /app/<GRADIO_IFACE>.py" > /scripts/run_script.sh
RUN chmod +x /scripts/run_script.sh
# Set the entrypoint to run the script
ENTRYPOINT ["/bin/bash", "-c", "/scripts/run_script.sh"]
docker-compose.yaml
version: '3.7'
services:
controlnet:
volumes:
- .:/app
build:
context: .
ports:
- "5000:5000"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
I know that newconda
is kinda ugly, but did not want to mess with the one that comes with the pytorch docker image (outdated version).