kiri-art / stable-diffusion-react-nextjs-mui-pwa

PWA Web App front end for Stable Diffusion, on React/NextJS with Material UI
https://kiri.art/
MIT License
127 stars 32 forks source link

Running with docker #46

Open phirestalker opened 9 months ago

phirestalker commented 9 months ago

Does anyone have a recommended Dockerfile to run this with, or at least a good image to start with?

gadicc commented 9 months ago

Hey, this is on the roadmap but no ETA as unfortunately there are a lot of more pressing issues to be prioritized first.

However, I'd probably start with off with something like:

FROM node:20 # next LTS from end October

RUN apt-get update
RUN apt-get yarnpkg

# install mongo, at least for now
RUN apt-get install -yqqq mongodb-org

WORKDIR /usr/src/app
COPY package.json yarn.lock .
RUN yarn install

COPY . . 
EXPOSE 3000
CMD [ "yarn", "dev" ]

This is just a starting point though and I haven't tested this... if you come up with something good, please send as a PR! :pray: :grin:

phirestalker commented 9 months ago

On a related note, is there somewhere with a list of the environment variables. I imagine it wouldn't be difficult to read them from the source code, but where would I look?

gadicc commented 9 months ago

Heh, no, I mean, here:

$ $ grep -E 'getenv|environ.get' `find . -type f -name \*.py`
./api/utils/storage/S3Storage.py:AWS_S3_ENDPOINT_URL = os.environ.get("AWS_S3_ENDPOINT_URL", None)
./api/utils/storage/S3Storage.py:AWS_S3_DEFAULT_BUCKET = os.environ.get("AWS_S3_DEFAULT_BUCKET", None)
./api/getScheduler.py:HF_AUTH_TOKEN = os.getenv("HF_AUTH_TOKEN")
./api/getScheduler.py:DEFAULT_SCHEDULER = os.getenv("DEFAULT_SCHEDULER", SCHEDULERS[0])
./api/precision.py:MODEL_REVISION = os.getenv("MODEL_REVISION")
./api/send.py:SEND_URL = os.getenv("SEND_URL")
./api/send.py:SIGN_KEY = os.getenv("SIGN_KEY", "")
./api/send.py:container_id = os.getenv("CONTAINER_ID")
./api/download_checkpoint.py:CHECKPOINT_URL = os.environ.get("CHECKPOINT_URL", None)
./api/lib/vars.py:RUNTIME_DOWNLOADS = os.getenv("RUNTIME_DOWNLOADS") == "1"
./api/lib/vars.py:USE_DREAMBOOTH = os.getenv("USE_DREAMBOOTH") == "1"
./api/lib/vars.py:MODEL_ID = os.environ.get("MODEL_ID")
./api/lib/vars.py:PIPELINE = os.environ.get("PIPELINE")
./api/lib/vars.py:HF_AUTH_TOKEN = os.getenv("HF_AUTH_TOKEN")
./api/convert_to_diffusers.py:CHECKPOINT_CONFIG_URL = os.environ.get("CHECKPOINT_CONFIG_URL", None)
./api/convert_to_diffusers.py:CHECKPOINT_ARGS = os.environ.get("CHECKPOINT_ARGS", None)
./api/download.py:HF_AUTH_TOKEN = os.environ.get("HF_AUTH_TOKEN")
./api/download.py:RUNTIME_DOWNLOADS = os.environ.get("RUNTIME_DOWNLOADS")
./api/download.py:            model_url=os.environ.get("MODEL_URL"),
./api/download.py:            model_id=os.environ.get("MODEL_ID"),
./api/download.py:            hf_model_id=os.environ.get("HF_MODEL_ID"),
./api/download.py:            model_revision=os.environ.get("MODEL_REVISION"),
./api/download.py:            model_precision=os.environ.get("MODEL_PRECISION"),
./api/download.py:            checkpoint_url=os.environ.get("CHECKPOINT_URL"),
./api/download.py:            checkpoint_config_url=os.environ.get("CHECKPOINT_CONFIG_URL"),
./api/loadModel.py:PIPELINE = os.getenv("PIPELINE")
./api/server.py:server.config.CORS_ORIGINS = os.getenv("CORS_ORIGINS") or "*"

(with duplicates deleted) but you're right this should be more accessible. Maybe it will be a good idea to put them all in one file with comments. Note also the AWS code uses that bota3 library which uses some of its own environment variables too.

phirestalker commented 9 months ago

That's great thanks. I don't see anything about mongo. I installed mongo, but it said something about a password, and I thought there would be more things I need to set.

EDIT: tires screeching This is a node project, where did Python come from? Did you change to Python for your live site?

gadicc commented 9 months ago

Hey again.

1) Mongo... yeah, that's just a warning... you don't need a password for local development and sd-mui will work with the default settings with no additional setup.

2) Env vars. Big apologies from me! Sorry! I was answering issues on both repos and got confused. The docker-diffusers-api is indeed all in python, but is already all dockerized in a nice container. The above environment variables have nothing to do with the webui. Sorry again. Take two:

I believe that's it... but let me know if you run into any thing else, and thanks for helping me consolidate these all in one place :sweat_smile: