{"id":20498110,"url":"https://github.com/vr-voyage/degu-diffusion-docker","last_synced_at":"2026-05-01T12:32:27.953Z","repository":{"id":114353146,"uuid":"555565959","full_name":"vr-voyage/degu-diffusion-docker","owner":"vr-voyage","description":"Docker and Docker-compose setup for my Self-hosted StableDiffusion Discord bot","archived":false,"fork":false,"pushed_at":"2022-11-12T17:44:43.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T20:44:07.539Z","etag":null,"topics":["discord","discord-bot","docker","self-hosted","stable-diffusion","stablediffusion","waifu-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vr-voyage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-21T20:56:44.000Z","updated_at":"2022-12-18T15:32:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"d30936a4-b514-4235-9041-73471cb8bfd5","html_url":"https://github.com/vr-voyage/degu-diffusion-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vr-voyage/degu-diffusion-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vr-voyage%2Fdegu-diffusion-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vr-voyage%2Fdegu-diffusion-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vr-voyage%2Fdegu-diffusion-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vr-voyage%2Fdegu-diffusion-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vr-voyage","download_url":"https://codeload.github.com/vr-voyage/degu-diffusion-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vr-voyage%2Fdegu-diffusion-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32497812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","discord-bot","docker","self-hosted","stable-diffusion","stablediffusion","waifu-diffusion"],"created_at":"2024-11-15T18:13:05.112Z","updated_at":"2026-05-01T12:32:27.930Z","avatar_url":"https://github.com/vr-voyage.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeguDiffusion Docker image\n\nThis repository contains the file to build the official Docker image of\nmy Discord bot software [**DeguDiffusion**](https://github.com/vr-voyage/degu-diffusion),\nthat allows you to run your own AI images generation bot on Discord\nusing a local installation of StableDiffusion.\n\n![Screenshot of a bot usage](https://github.com/vr-voyage/degu-diffusion/raw/main/screenshots/GenerateForm-Result.png)\n\n![Screenshot of /degudiffusion form](https://github.com/vr-voyage/degu-diffusion/raw/main/screenshots/Apps-Repeat-Diffusion-Form.png)\n\nThe concept behind it is simple :\n\n* You create a bot account, and add its token to the `.env` file as `DISCORD_TOKEN`.\n* The software will use the bot account to connect to Discord and register image\n  generation commands (`/degudiffusion` notably) on the servers it has been invited\n  to.\n* Users on the servers use these commands to send image generation requests to your server.\n* Your server generate the images, using a local installation of\n  [HuggingFaces StableDiffusion](https://huggingface.co/CompVis/stable-diffusion-v1-4),\n  and send back the result through Discord.\n\nYou can of course run the bot inside Docker, while being connected to\nDiscord with another account on the same machine.\n\nThe software is available under MIT license.\n\n# Example setup\n\n**.env**\n\n```bash\n# Make sure your bot has sufficient rights and privileges.\n# Write your Discord bot token after the '='. No quotes needed.\nDISCORD_TOKEN=\n\n# Make sure you accepted the license on\n# https://huggingface.co/CompVis/stable-diffusion-v1-4\n# Write your Huggingfaces token after the '='. No quotes needed.\nHUGGINGFACES_TOKEN=\n```\n\n**docker-compose.yml**\n\n```yaml\nversion: \"3.9\"\nservices:\n  degu:\n    image: vrvoyage/degudiffusion:1.0\n    #build: .\n    env_file: .env\n    environment:\n      - STABLEDIFFUSION_CACHE_DIR=stablediffusion_cache\n      - IMAGES_OUTPUT_DIRECTORY=generated # Can be commented if SAVE_IMAGES_TO_DISK is set to false\n      # - SAVE_IMAGES_TO_DISK=false # If you uncomment this, you can comment the first volume\n      # - STABLEDIFFUSION_MODE=fp16 # If you're low on VRAM\n      # - STABLEDIFFUSION_MODEL_NAME=hakurei/waifu-diffusion # If you want to use Waifu Diffusion\n    volumes:\n      - ./generated:/app/generated # Only required if SAVE_IMAGES_TO_DISK=false isn't set\n      - ./cache:/app/stablediffusion_cache # Related to STABLEDIFFUSION_CACHE_DIR\n      - ./config:/app/config # Can be mounted in Read-Only if a 'replacers.json' file is already present\n    deploy:\n      resources:\n        reservations:\n          devices:\n            - driver: nvidia\n              count: all\n              capabilities: [gpu]\n```\n\n## Running the example setup\n\n```bash\ndocker-compose up\n```\n\n# Requirements\n\n* As you can understand, the server is required to have access to a GPU.  \n  The only tested setup is Windows / NVIDIA Graphics Card / CUDA.  \n  This setup has not been tested at all with CPU only setup.  \n  This setup has not been tested at all with ROCM.\n\n* Ensure that you can use the GPU through Docker.\n\n* A [Discord Bot](https://discord.com/developers/applications) Token.  \n  Environment variable : `DISCORD_TOKEN`  \n  See below for more information about how to create and register your\n  own bot on Discord, and how to retrieve its token.\n\n* A [HuggingFaces Token](https://huggingface.co/settings/tokens).  \n  Environment variable : `HUGGINGFACES_TOKEN`  \n  This is required to download the weights the first time.  \n  Once done, you can set the environment variable\n  `STABLEDIFFUSION_LOCAL_ONLY=true` to reuse the local files,\n  in which case `HUGGINGFACES_TOKEN` isn't required anymore.\n\n* Accepting the [licence terms of StableDiffusion](https://huggingface.co/CompVis/stable-diffusion-v1-4)  \n  The licence is pretty permissive, but to download the weights from\n  HuggingFaces, you'll have to click on the accept button on the\n  page :  \n  https://huggingface.co/CompVis/stable-diffusion-v1-4\n\n* Setup `DISCORD_TOKEN` and `HUGGINGFACES_TOKEN` environment variables.\n\n## Creating a Discord application and a bot account\n\n* Go to the [Discord Developer portal](https://discord.com/developers/applications).\n* Create a \"New application\", by clicking the upper right button near your Profile icon.\n* Setup the name then make sure you're currently editing your new application.\n* In Bot (Left panel), in \"Build-A-Bot\", click on \"Add Bot\" and Confirm.\n* While you are on the bot configuration pane, enable :\n  * **Message Content Intent**  \n  \u003e You can leave other intents disabled.\n* On Oauth2 General (Left panel), select :\n  * **AUTHORIZATION METHOD**  \n  In-app Authorization\n  * **SCOPES**\n    * `bot`\n    * `application.commands`\n  * **BOT PERMISSIONS**\n    * Read Messages / View Channels\n    * Send Messages\n    * Create Public Threads\n    * Send Messages in Threads\n    * Attach Files\n * On OAuth2 URL Generator (Left panel) : \n   * Select the same **SCOPES** (`bot` and `application.commands`) and **PERMISSIONS**.\n   * Copy the generated URL at the bottom.\n* Enter this URL in your browser to invite the generated bot on one of your servers.  \n\u003e You can also send this link to others servers admins who'd like to invite the bot to\n\u003e their servers.\n* In Bot, again, click on 'Reset Token' and save it as `DISCORD_TOKEN` in the `.env` file.\n\n\u003e If the permissions were wrong :  \n\u003e   Set the permissions again on both panels  \n\u003e   Open the new URL in your browser and invite the Bot again on the same server.\n\n### Screenshots of the authorizations\n\n#### Oauth2 General\n\n![Screenshot of authorizations checkboxes required in Oauth2 General](https://github.com/vr-voyage/degu-diffusion/raw/main/screenshots/Discord-App-Oauth2-General.png)\n\n#### Bot intentions\n\n![Screenshot of the Bot setup](https://github.com/vr-voyage/degu-diffusion/raw/main/screenshots/Discord-Bot-Intentions.png)\n\n#### Oauth2 URL Generator\n\n![Screensoht of authorizations checkboxes required in Oauth2 URL Generator](https://github.com/vr-voyage/degu-diffusion/raw/main/screenshots/Discord-App-Oauth2-URL-Generator.png)\n\n#### Discord Bot Token\n\nIf you don't know it, click on \"Reset Token\" in the \"Bot\" section of your\napplication.\nYou can view your application settings on the [Discord Developer Portal](https://discord.com/developers/applications).\n\n![Screenshot of the Reset Token page](https://github.com/vr-voyage/degu-diffusion/raw/main/screenshots/Discord-Bot-Token.png)\n\n# Environment variables\n\n* `IMAGES_OUTPUT_DIRECTORY`  \n  Define where you want to store the generated pictures.  \n  **Default** : `generated`  \n  Spaces are allowed. No need to use quotes.  \n  The directory will be created if it doesn't exist.  \n  Example : `IMAGES_OUTPUT_DIRECTORY=another folder`  \n  \u003e This setting is ignored when `SAVE_IMAGES_TO_DISK` is set to `false`.  \n  \u003e In the `docker-compose.yml` sample, this setting is linked\n  \u003e to the `./generated` mountpoint.\n\n* `SAVE_IMAGES_TO_DISK`  \n  Define whether generated files are saved on the disk or not.  \n  **Default** : `true`  \n  Example : `SAVE_IMAGES_TO_DISK=false`  \n  \u003e This setting is ignored when testing Stable Diffusion alone.\n\n* `STABLEDIFFUSION_MODEL_NAME`  \n  Determine the HuggingFaces model used by `StableDiffusionPipeline`.  \n  **Default** : `CompVis/stable-diffusion-v1-4`  \n  Example : `STABLEDIFFUSION_MODEL_NAME=hakurei/waifu-diffusion`\n\n* `STABLEDIFFUSION_MODE`  \n  Allows you to select between different StableDiffusion modes.  \n  **Default** : `fp32`  \n  Currently only fp16 and fp32 are supported.  \n  VRAM usage is lower in fp16, so if you're low on VRAM,\n  set this to `fp16`.  \n  Example : `STABLEDIFFUSION_MODE=fp16`\n\n* `MAX_IMAGES_PER_JOB`  \n  Maximum number of images to output per job request.  \n  **Default** : `64`  \n  That means that the **NUMBER OF IMAGES** typed in `/degudiffusion`\n  form will be clamped to that maximum value.  \n  Example : `MAX_IMAGES_PER_JOB=8`\n\n* `MAX_INFERENCES_PER_IMAGE`  \n  Maximum number of inferences steps per image.  \n  **Default** : `120`  \n  This clamps the **INFERENCES** number typed in `/degudiffusion`\n  form to that maximum value.  \n  Example : `MAX_INFERENCES_PER_IMAGE=30`\n\n* `MAX_GUIDANCE_SCALE_PER_IMAGE`  \n  Maximal guidance scale allowed.  \n  **Default** : `20`  \n  This clamps the **GUIDANCE SCALE** number typed in `/degudiffusion`\n  form will be clamped to that maximum value.  \n  Example : `MAX_GUIDANCE_SCALE_PER_IMAGE=7.5`\n\n* `IMAGES_WIDTH` and `IMAGES_HEIGHT`  \n  The width and height of generated images.  \n  **Default** : `512`  \n  Be ***EXTREMELY*** careful with this one, VRAM usage grows dramatically\n  when using higher values.  \n  I highly recommend to switch to fp16 when using more than 512x512.  \n  Going below 512 in any direction will generally lead to garbage results.  \n  Example :  \n  `IMAGES_WIDTH=768`  \n  `IMAGES_HEIGHT=768`\n\n* `MAX_IMAGES_BEFORE_THREAD`  \n  The number of images after which the bot will automatically create a thread.  \n  **Default** : `2`  \n  That means that if you set it to 5 :  \n  When requesting up to 5 images per job, the bot will output everything\n  on the channel from where the job request was done.  \n  When requesting 6 images or more, the bot will create a thread and\n  send the results inside this thread.  \n  Example : `MAX_IMAGES_BEFORE_THREAD=5`\n\n* `COMPACT_RESPONSES`  \n  When set to `True` or `true`, the job response will only include the pictures,\n  without any further details (like the Seed, Actual Prompt.).  \n  **Default** : `false`  \n  Example : `COMPACT_RESPONSES=True`  \n  \u003e You can still use \"Check Degu PNG Metadata\" when using compact responses.\n\n* `DEFAULT_IMAGES_PER_JOB`  \n  The default **NUMBER OF IMAGES** used in `/degudiffusion` form.  \n  **Default** : `8`  \n  Example : `DEFAULT_IMAGES_PER_JOB=3`\n\n* `DEFAULT_PROMPT`  \n  The default **PROMPT** used in `/degudiffusion` form.  \n  **Default** : `Degu enjoys its morning coffee by {random_artists}, {random_tags}`  \n  Example : `DEFAULT_PROMPT=A Nendoroid of a Chipmunk by {random_artists}, {lyuma_cheatcodes}`\n\n* `DEFAULT_SEED`  \n  The default **SEED** used in `/degudiffusion` form.  \n  **Default** to an empty value.  \n  Note that you don't have to type a SEED value, in Degu Diffusion.  \n  When no seed is provided, a random seed is generated for you.  \n  Example : `DEFAULT_SEED=-1`\n\n* `DEFAULT_INFERENCES_STEPS`  \n  The default number of **INFERENCES** used in `/degudiffusion` form.  \n  **Default** : `60`  \n  Example : `DEFAULT_INFERENCES_STEPS=30`\n\n* `DEFAULT_GUIDANCE_SCALE`  \n  The default **GUIDANCE SCALE** used in `/degudiffusion` form.  \n  **Default** : `7.5`  \n  Example : `DEFAULT_GUIDANCE_SCALE=15`\n\n* `SEED_MINUS_ONE_IS_RANDOM`  \n  Determine if -1 should be interpreted as a random seed or an actual seed value.  \n  **Default** : True  \n  By default, now, `-1` is treated as a random value, since many users\n  are used to type `-1` to get a random seed.  \n  Note that you don't have to type a SEED value, in Degu Diffusion.  \n  When no seed is provided, a random seed is generated for you.  \n  Example : `SEED_MINUS_ONE_IS_RANDOM=false`\n\n* `STABLEDIFFUSION_LOCAL_ONLY`  \n  Force `StableDiffusionPipeline` to use predownloaded local files only, and avoid\n  connecting to the internet.  \n  **Default** : `false`  \n  Example : `STABLEDIFFUSION_LOCAL_ONLY=true`  \n  \u003e When set to true, `HUGGINGFACES_TOKEN` is not required anymore.\n\n* `STABLEDIFFUSION_CACHE_DIR`  \n  Determine where `StableDiffusionPipeline` download its files to.  \n  **Empty by Default**  \n  This is mainly used for Docker setups.  \n  When not set, or set to an empty string, `StableDiffusionPipeline` will\n  determine where to download its files.  \n  Example : `STABLEDIFFUSION_CACHE_DIR=sd_cache`  \n  \u003e The directory will be created if it doesn't exist.\n\n* `TORCH_DEVICE`  \n  Determine the PyTorch device used. Default to \"cuda\".  \n  **Default** : `cuda`  \n  Any value other that `cuda` is untested.  \n  Example : `TORCH_DEVICE=rocm`\n\n* `FORM_NUMBER_OF_IMAGES_INPUT_MAX`  \n  Maximum number of characters allowed for **NUMBER OF IMAGES** in\n  /degudiffusion form.  \n  **Default** : `4`  \n  Example : `FORM_NUMBER_OF_IMAGES_INPUT_MAX=3`\n\n* `FORM_PROMPT_INPUT_MAX`  \n  Maximum number of characters allowed for **PROMPT** in\n  /degudiffusion form.  \n  **Default** : `500`  \n  Example : `FORM_PROMPT_INPUT_MAX=100`  \n  \u003e Note that with the default setup, StableDiffusion will\n  \u003e parse up to 77 tokens and ignore the rest.  \n\n* `FORM_SEED_INPUT_MAX`  \n  Maximum number of characters allowed for **SEED** in\n  /degudiffusion form.  \n  **Default** : `38`  \n  Example : `FORM_SEED_INPUT_MAX=200`\n\n* `FORM_INFERENCES_INPUT_MAX`\n  Maximum number of characters allowed for **INFERENCES** in\n  /degudiffusion form.  \n  **Default** : `3`  \n  Example : `FORM_INFERENCES_INPUT_MAX=2`\n\n* `FORM_GUIDANCE_SCALE_INPUT_MAX`  \n  Maximum number of characters allowed for GUIDANCE SCALE in\n  /degudiffusion form.  \n  **Default** : `6`  \n  Example : `FORM_GUIDANCE_SCALE_INPUT_MAX=3`  \n  \u003e Be careful, conversion from float to string adds at least one decimal.  \n  This conversion might lead to errors when using the `DEFAULT_GUIDANCE_SCALE`,\n  while preparing the form.  \n  For example, if `DEFAULT_GUIDANCE_SCALE=7` then the displayed value\n  will be `7.0`, and will take 3 characters.  \n  If `FORM_GUIDANCE_SCALE_INPUT_MAX` is set to `2` characters, the form\n  will become unuseable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvr-voyage%2Fdegu-diffusion-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvr-voyage%2Fdegu-diffusion-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvr-voyage%2Fdegu-diffusion-docker/lists"}