-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker files #1418
Add docker files #1418
Changes from 1 commit
97769de
ef5da9d
5b30983
5b30804
79ba09c
992979b
14b1acd
b68807b
45b1bdd
3af1528
ca45144
3cd3c7e
40e716b
8072641
c07de3d
854a4fd
ad9fc1e
81a45ed
ac5af9f
c37f540
17e9811
e5cc831
70a8626
19aa714
b5ccc63
416448b
1b094f3
d79de68
6d9d2b3
b05be6f
97f27c1
2c42a3e
97ac2e3
8b5b1b9
7c75e49
509a61b
66ec479
dfa4da0
b1ea926
6da2903
b32bcde
34d7617
4da6c44
ab528e1
e838927
b48ff50
6a5b5dc
6fb8f5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM nvidia/cuda:12.3.1-base-ubuntu22.04 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV CMDARGS --share | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y curl libgl1 libglib2.0-0 python3-pip python-is-python3 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY requirements_docker.txt requirements_versions.txt /tmp/ | ||
RUN pip install --no-cache-dir -r /tmp/requirements_docker.txt -r /tmp/requirements_versions.txt && \ | ||
rm -f /tmp/requirements_docker.txt /tmp/requirements_versions.txt | ||
RUN curl -fsL -o /usr/local/lib/python3.10/dist-packages/gradio/frpc_linux_amd64_v0.2 https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 && \ | ||
chmod +x /usr/local/lib/python3.10/dist-packages/gradio/frpc_linux_amd64_v0.2 | ||
|
||
RUN adduser --disabled-password --gecos '' user && \ | ||
mkdir -p /content/app | ||
|
||
COPY . /content/app | ||
RUN chown -R user:user /content | ||
|
||
WORKDIR /content | ||
USER user | ||
|
||
RUN mv /content/app/models /content/app/models.org | ||
|
||
CMD /content/app/entrypoint.sh ${CMDARGS} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: '3.9' | ||
|
||
services: | ||
app: | ||
build: . | ||
image: whitehara/fooocus | ||
#ports: | ||
#- 7865:7865 | ||
environment: | ||
- CMDARGS=--share # arguments for entry_with_updte.py | ||
- DATADIR=/content/data # directory which stores models, outputs dir | ||
- config_path=/content/data/config.txt | ||
- config_example_path=/content/data/config_modification_tutorial.txt | ||
- path_checkpoints=/content/data/models/checkpoints/ | ||
- path_loras=/content/data/models/loras/ | ||
- path_embeddings=/content/data/models/embeddings/ | ||
- path_vae_approx=/content/data/models/vae_approx/ | ||
- path_upscale_models=/content/data/models/upscale_models/ | ||
- path_inpaint=/content/data/models/inpaint/ | ||
- path_controlnet=/content/data/models/controlnet/ | ||
- path_clip_vision=/content/data/models/clip_vision/ | ||
- path_fooocus_expansion=/content/data/models/prompt_expansion/fooocus_expansion/ | ||
- path_outputs=/content/app/outputs/ # Warning: If it is not under '/content/app', you can't see history log! | ||
- default_model=juggernautXL_version6Rundiffusion.safetensors | ||
- default_performance=Speed | ||
volumes: | ||
- ./data:/content/data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using a virtual volume here will increase the loading speed of models in Fooocus. Please test and adjust accordingly. See https://docs.docker.com/storage/volumes/#use-a-volume-with-docker-compose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your comment.
|
||
tty: true | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
device_ids: ['0'] | ||
capabilities: [compute, utility] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Fooocus on Docker | ||
|
||
It's based on NVIDIA CUDA 12.3. See [Dockerfile](Dockerfile) for details. | ||
|
||
PyTorch version is 2.1. See [requirements_docker.txt](requirements_docker.txt) for details. | ||
|
||
## Quick start with pre-build container | ||
|
||
Download [docker-compose.yml](docker-compose.yml), Then run the docker container `mkdir -p -m=777 data && docker compose up` | ||
When you will see gradio URL in the console message, you can access the URL on your browser. | ||
|
||
Your models, outputs are stored into './data' (You can change the location). | ||
|
||
## Details | ||
|
||
### Paths inside the container | ||
|
||
|Path|Details| | ||
|-|-| | ||
|/content/app|The application stored folder| | ||
|/content/app/models.org|Original 'models' folder.<br> Files are copied to the '/content/app/models' which is symlinked to '/content/data/models' every time the container boots. (Existing files will not be overwritten.) | | ||
|/content/data|Persistent volume mount point| | ||
|/content/data/models|The folder is symlinked to '/content/app/models'| | ||
|/content/data/outputs|The folder is symlinked to '/content/app/outputs'| | ||
|
||
### Environments | ||
|
||
You can change 'config.txt' parameters by using environments. | ||
**The priority of using the environments is higher than the values defined in 'config.txt'. And they will be saved to the 'config_modification_tuorial.txt'** | ||
|
||
Docker specified envronments are there. They are used by 'entrypoint.sh' | ||
|Environment|Details| | ||
|-|-| | ||
|DATADIR|'/content/data' location.| | ||
|CMDARGS|Arguments for [entry_with_update.py](entry_with_update.py) which is called by [entrypoint.sh](entrypoint.sh)| | ||
|config_path|'config.txt' location| | ||
|config_example_path|'config_modification_tutorial.txt' location| | ||
|
||
You can also use the same json key names and values explained in the 'config_modification_tutorial.txt' as the envronments. | ||
See samples in the [docker-compose.yml](docker-compose.yml) | ||
|
||
**Please keep 'path_outputs' under '/content/app'. Otherwise you will see an error when you open the history log.** |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
ORIGINALDIR=/content/app | ||
# Use predefined DATADIR if it is defined | ||
[[ x"${DATADIR}" == "x" ]] && DATADIR=/content/data | ||
|
||
# make persistent dir from original dir | ||
function mklink () { | ||
mkdir -p $DATADIR/$1 | ||
ln -s $DATADIR/$1 $ORIGINALDIR | ||
} | ||
|
||
cd $ORIGINALDIR | ||
|
||
# models | ||
mklink models | ||
# Copy original files | ||
(cd $ORIGINALDIR/models.org && cp -Rpn . $ORIGINALDIR/models/) | ||
|
||
# outputs | ||
mklink outputs | ||
|
||
# Start application | ||
python entry_with_update.py $* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
torch==2.1.1 | ||
torchvision==0.16.1 | ||
torchaudio==2.1.1 | ||
torchtext==0.16.1 | ||
torchdata==0.7.1 | ||
xformers==0.0.23 | ||
triton==2.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest changing the image name to something more generic. Maybe plainly
fooocus
?