Files
danbooru/docker-compose.yaml
nonamethanks d1b6f30517 Docker compose: add project name to the file.
When docker compose creates the various services, it names the
containers like <projectname>-<servicename>-<id>. If
COMPOSE_PROJECT_NAME is not set and there's no name property
at the root level of the yaml, the default project name is the
current directory. This breaks the deployment from directories
with unusable names, such as C:\.

Fixes #5304.

This should not break existing installations that are pulling from
master, as long as the base folder is danbooru/ (default for git clone).
2022-10-21 18:24:30 +02:00

97 lines
3.1 KiB
YAML

# A Docker Compose file that launches a minimal Danbooru instance. This is
# suitable as a quick demo or for personal use, not for public-facing sites.
#
# This will start a Danbooru instance running on http://localhost:3000.
#
# Usage:
#
# docker-compose up
# docker-compose down
#
# References:
#
# * https://docs.docker.com/get-docker/
# * https://docs.docker.com/compose/install/
# * https://docs.docker.com/compose/compose-file/compose-versioning
# * https://docs.docker.com/compose/release-notes
# Version 3.4 is the latest version that is supported by the version of Docker
# Compose shipped with Ubuntu 18.04 LTS (version 1.17.4).
version: "3.4"
name: danbooru
x-base-template: &base-template
user: root
# pull_policy: always # Uncomment this to always pull the latest image when deploying.
image: ghcr.io/danbooru/danbooru:production # you can change this to danbooru:master to get the latest upstream changes
environment:
RAILS_ENV: production # Set this to development to force danbooru to freshly compile js/css assets (for example if you're doing local development)
RAILS_SERVE_STATIC_FILES: true
PUMA_WORKERS: 1
DATABASE_URL: postgresql://danbooru@postgres/danbooru
DANBOORU_REDIS_URL: redis://redis:6379
DANBOORU_IQDB_URL: http://iqdb:5588
DANBOORU_CANONICAL_URL: http://localhost:3000
# # If you want to host danbooru under your own domain you need to replace the above line with the following (replace with your actual domain):
# DANBOORU_CANONICAL_URL: https://danbooru.mydomain.com
# DANBOORU_HOSTNAME: danbooru.mydomain.com
volumes:
- "danbooru-images:/danbooru/public/data"
# # If you want to do local development you can uncomment these lines to force the container to use your local changes
# # Simply replace $HOME/danbooru to where you cloned the repo
# - "$HOME/danbooru/app:/danbooru/app"
# - "$HOME/danbooru/config:/danbooru/config"
# - "$HOME/danbooru/db:/danbooru/db"
# - "$HOME/danbooru/test:/danbooru/test"
services:
danbooru:
<<: *base-template
ports:
- "3000:3000"
tmpfs:
- /tmp
depends_on:
- postgres
command: ["bash", "-c", "bin/rails db:prepare && bin/rails db:seed && bin/rails server -b 0.0.0.0"]
cron:
<<: *base-template
depends_on:
- danbooru
command: ["bash", "-c", "bin/wait-for-http http://danbooru:3000 5s && bin/rails danbooru:cron"]
jobs:
<<: *base-template
depends_on:
- danbooru
command: ["bash", "-c", "bin/wait-for-http http://danbooru:3000 5s && bin/good_job start"]
# https://github.com/danbooru/iqdb
# https://hub.docker.com/repository/docker/evazion/iqdb
iqdb:
image: evazion/iqdb
volumes:
- "iqdb-data:/iqdb/data"
command: ["http", "0.0.0.0", "5588", "/iqdb/data/iqdb.sqlite"]
redis:
image: redis
postgres:
image: evazion/postgres
environment:
POSTGRES_USER: danbooru
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- "danbooru-data:/var/lib/postgresql/data"
volumes:
danbooru-images:
name: danbooru-images
danbooru-data:
name: danbooru-data
iqdb-data:
name: iqdb-data