Add a Docker Compose file that launches a minimal Danbooru instance in a Docker container with a single command. This is suitable as a quick demo or for personal use, not for public-facing sites. To use it, just run `bin/danbooru`. This is a wrapper script that installs Docker Compose then uses it to start Danbooru. This will generate a lot of debug output and take several minutes while it builds the Docker containers. Be patient. When it's done, you should have an empty booru accessible at http://localhost.
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# This script starts Danbooru by installing Docker and Docker Compose, then
|
|
# starting Danbooru in a container. Danbooru will be available at http://localhost.
|
|
#
|
|
# Usage:
|
|
#
|
|
# bin/danbooru up # start Danbooru
|
|
# bin/danbooru down # stop and remove Danbooru container.
|
|
# bin/danbooru help # show Docker Compose help
|
|
#
|
|
# Alternatively, if you already have Docker installed, you can just do:
|
|
#
|
|
# docker-compose -f config/docker/docker-compose.simple.yaml up
|
|
#
|
|
# This script is just a wrapper for that command.
|
|
|
|
install_docker_compose() {
|
|
if docker-compose version > /dev/null; then
|
|
return
|
|
fi
|
|
|
|
if apt --version; then
|
|
sudo apt install docker docker-compose
|
|
elif dnf --version; then
|
|
sudo dnf install docker docker-compose
|
|
elif pacman --version; then
|
|
sudo pacman -Sy docker docker-compose
|
|
else
|
|
echo "Error: Couldn't automatically install docker-compose. Install docker-compose manually."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
start_docker() {
|
|
if docker version > /dev/null; then
|
|
return
|
|
fi
|
|
|
|
sudo systemctl start docker
|
|
}
|
|
|
|
docker_compose() {
|
|
COMPOSE_FILE="$(dirname "$(realpath "$0")")/../config/docker/docker-compose.simple.yaml"
|
|
docker-compose -f "$COMPOSE_FILE" "$@"
|
|
}
|
|
|
|
install_docker_compose
|
|
start_docker
|
|
docker_compose "${@:-up}"
|