pixelfed/docker-compose.yml

176 lines
6.1 KiB
YAML
Raw Normal View History

2018-05-20 13:02:29 +00:00
---
2024-01-06 14:19:36 +00:00
version: "3"
2024-01-06 14:19:36 +00:00
###############################################################
# Please see docker/README.md for usage information
###############################################################
2018-05-20 13:02:29 +00:00
services:
2024-01-06 16:43:48 +00:00
# HTTP/HTTPS proxy
#
2024-01-15 15:14:44 +00:00
# Sits in front of the *real* webserver and manages SSL and (optionally)
# load-balancing between multiple web servers
#
2024-01-15 19:56:35 +00:00
# You can disable this service by setting [DOCKER_PROXY_PROFILE="disabled"]
# in your [.env] file - the setting is near the bottom of the file.
#
# This also disables the [proxy-acme] service, if this is not desired, change the
# [DOCKER_PROXY_ACME_PROFILE] setting to an empty string [""]
#
2024-01-06 16:43:48 +00:00
# See: https://github.com/nginx-proxy/nginx-proxy/tree/main/docs
proxy:
image: nginxproxy/nginx-proxy:1.4
2024-01-06 18:01:48 +00:00
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-proxy"
2024-01-15 14:42:54 +00:00
restart: unless-stopped
2024-01-15 19:20:22 +00:00
profiles:
2024-01-15 19:56:35 +00:00
- ${DOCKER_PROXY_PROFILE:-}
2024-01-06 16:43:48 +00:00
volumes:
2024-01-06 18:01:48 +00:00
- "${DOCKER_HOST_SOCKET_PATH}:/tmp/docker.sock:ro"
2024-01-06 16:43:48 +00:00
- "${DOCKER_CONFIG_ROOT}/proxy/conf.d:/etc/nginx/conf.d"
- "${DOCKER_CONFIG_ROOT}/proxy/vhost.d:/etc/nginx/vhost.d"
2024-01-06 18:01:48 +00:00
- "${DOCKER_CONFIG_ROOT}/proxy/certs:/etc/nginx/certs"
- "${DOCKER_DATA_ROOT}/proxy/html:/usr/share/nginx/html"
2024-01-06 16:43:48 +00:00
ports:
- "${DOCKER_PROXY_PORT_EXTERNAL_HTTP}:80"
- "${DOCKER_PROXY_PORT_EXTERNAL_HTTPS}:443"
2024-01-17 15:47:39 +00:00
healthcheck:
2024-01-17 16:30:40 +00:00
test: "curl --fail https://${APP_DOMAIN}/api/service/health-check"
2024-01-17 16:11:36 +00:00
interval: "${DOCKER_PROXY_HEALTHCHECK_INTERVAL:-10s}"
2024-01-17 15:47:39 +00:00
retries: 2
timeout: 5s
2024-01-06 16:43:48 +00:00
# Proxy companion for managing letsencrypt SSL certificates
#
2024-01-15 19:56:35 +00:00
# You can disable this service by setting [DOCKER_PROXY_ACME_PROFILE="disabled"]
# in your [.env] file - the setting is near the bottom of the file.
#
2024-01-06 16:43:48 +00:00
# See: https://github.com/nginx-proxy/acme-companion/tree/main/docs
proxy-acme:
image: nginxproxy/acme-companion
2024-01-06 18:01:48 +00:00
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-proxy-acme"
2024-01-15 14:42:54 +00:00
restart: unless-stopped
2024-01-15 19:20:22 +00:00
profiles:
2024-01-15 19:56:35 +00:00
- ${DOCKER_PROXY_ACME_PROFILE:-}
2024-01-06 16:43:48 +00:00
environment:
2024-01-06 18:01:48 +00:00
DEBUG: 0
2024-01-06 16:43:48 +00:00
DEFAULT_EMAIL: "${LETSENCRYPT_EMAIL}"
2024-01-06 18:01:48 +00:00
NGINX_PROXY_CONTAINER: "${DOCKER_CONTAINER_NAME_PREFIX}-proxy"
2024-01-06 16:43:48 +00:00
depends_on:
- proxy
volumes:
2024-01-17 14:41:48 +00:00
- "${DOCKER_CONFIG_ROOT}/proxy-acme:/etc/acme.sh"
- "${DOCKER_CONFIG_ROOT}/proxy/certs:/etc/nginx/certs"
2024-01-06 16:43:48 +00:00
- "${DOCKER_CONFIG_ROOT}/proxy/conf.d:/etc/nginx/conf.d"
- "${DOCKER_CONFIG_ROOT}/proxy/vhost.d:/etc/nginx/vhost.d"
2024-01-06 18:01:48 +00:00
- "${DOCKER_DATA_ROOT}/proxy/html:/usr/share/nginx/html"
2024-01-17 14:41:48 +00:00
- "${DOCKER_HOST_SOCKET_PATH}:/var/run/docker.sock:ro"
2024-01-06 16:43:48 +00:00
2024-01-06 14:19:36 +00:00
web:
image: "${DOCKER_IMAGE}:${DOCKER_TAG}"
2024-01-06 18:01:48 +00:00
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-web"
2019-06-03 02:53:13 +00:00
restart: unless-stopped
2024-01-06 18:01:48 +00:00
build:
2024-01-15 23:50:16 +00:00
target: ${DOCKER_RUNTIME}-runtime
args:
PHP_VERSION: "${PHP_VERSION:-8.1}"
PHP_BASE_TYPE: "${PHP_BASE_TYPE:-apache}"
PHP_DEBIAN_RELEASE: "${PHP_DEBIAN_RELEASE:-bullseye}"
APT_PACKAGES_EXTRA: "${APT_PACKAGES_EXTRA:-}"
PHP_PECL_EXTENSIONS_EXTRA: "${PHP_PECL_EXTENSIONS_EXTRA:-}"
PHP_EXTENSIONS_EXTRA: "${PHP_EXTENSIONS_EXTRA:-}"
2018-05-20 13:02:29 +00:00
volumes:
2024-01-06 14:19:36 +00:00
- "./.env:/var/www/.env"
2024-01-15 23:50:16 +00:00
- "${DOCKER_APP_CACHE_PATH}:/var/www/bootstrap/cache"
- "${DOCKER_APP_STORAGE_PATH}:/var/www/storage"
2024-01-06 16:43:48 +00:00
environment:
2024-01-06 18:01:48 +00:00
LETSENCRYPT_HOST: "${LETSENCRYPT_HOST}"
LETSENCRYPT_EMAIL: "${LETSENCRYPT_EMAIL}"
2024-01-15 23:50:16 +00:00
LETSENCRYPT_TEST: "${LETSENCRYPT_TEST:-}"
2024-01-06 18:01:48 +00:00
VIRTUAL_HOST: "${APP_DOMAIN}"
2024-01-06 16:43:48 +00:00
VIRTUAL_PORT: "80"
labels:
com.github.nginx-proxy.nginx-proxy.keepalive: 30
com.github.nginx-proxy.nginx-proxy.http2.enable: true
com.github.nginx-proxy.nginx-proxy.http3.enable: true
2024-01-15 19:39:59 +00:00
ports:
2024-01-15 20:19:04 +00:00
- "${DOCKER_WEB_PORT_EXTERNAL_HTTP:-8080}:80"
2020-04-11 15:48:02 +00:00
depends_on:
2020-04-11 15:52:05 +00:00
- db
2020-04-11 15:48:02 +00:00
- redis
2024-01-17 15:47:39 +00:00
healthcheck:
2024-01-17 16:30:40 +00:00
test: 'curl --header "Host: ${APP_DOMAIN}" --fail http://localhost/api/service/health-check'
2024-01-17 16:11:36 +00:00
interval: "${DOCKER_WEB_HEALTHCHECK_INTERVAL:-10s}"
2024-01-17 15:47:39 +00:00
retries: 2
timeout: 5s
2020-04-11 15:48:02 +00:00
worker:
2024-01-06 14:19:36 +00:00
image: "${DOCKER_IMAGE}:${DOCKER_TAG}"
2024-01-06 18:01:48 +00:00
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-worker"
2024-01-06 14:19:36 +00:00
command: gosu www-data php artisan horizon
2019-06-03 02:53:13 +00:00
restart: unless-stopped
2024-01-06 18:01:48 +00:00
build:
2024-01-15 23:50:16 +00:00
target: ${DOCKER_RUNTIME}-runtime
args:
PHP_VERSION: "${PHP_VERSION:-8.1}"
PHP_BASE_TYPE: "${PHP_BASE_TYPE:-apache}"
PHP_DEBIAN_RELEASE: "${PHP_DEBIAN_RELEASE:-bullseye}"
APT_PACKAGES_EXTRA: "${APT_PACKAGES_EXTRA:-}"
PHP_PECL_EXTENSIONS_EXTRA: "${PHP_PECL_EXTENSIONS_EXTRA:-}"
PHP_EXTENSIONS_EXTRA: "${PHP_EXTENSIONS_EXTRA:-}"
2019-04-22 02:40:32 +00:00
volumes:
2024-01-06 14:19:36 +00:00
- "./.env:/var/www/.env"
2024-01-15 23:50:16 +00:00
- "${DOCKER_APP_CACHE_PATH}:/var/www/bootstrap/cache"
- "${DOCKER_APP_STORAGE_PATH}:/var/www/storage"
2020-04-11 15:48:02 +00:00
depends_on:
2020-04-11 15:52:05 +00:00
- db
2020-04-11 15:48:02 +00:00
- redis
2024-01-17 15:47:39 +00:00
healthcheck:
test: gosu www-data php artisan horizon:status | grep running
2024-01-17 16:18:29 +00:00
interval: "${DOCKER_WORKER_HEALTHCHECK_INTERVAL:-10s}"
2024-01-17 15:47:39 +00:00
timeout: 5s
retries: 2
2020-04-11 15:48:02 +00:00
db:
2024-01-17 16:11:36 +00:00
image: mariadb:${DB_VERSION:-11.2}
2024-01-06 18:01:48 +00:00
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-db"
command: --default-authentication-plugin=mysql_native_password
2024-01-06 14:19:36 +00:00
restart: unless-stopped
2024-01-06 18:01:48 +00:00
env_file:
- ".env"
2018-05-20 13:02:29 +00:00
volumes:
2024-01-15 23:50:16 +00:00
- "${DOCKER_DB_DATA_PATH}:/var/lib/mysql"
2024-01-06 14:19:36 +00:00
ports:
- "${DOCKER_DB_PORT_EXTERNAL}:3306"
2024-01-17 15:47:39 +00:00
healthcheck:
test:
[
"CMD",
"healthcheck.sh",
"--su-mysql",
"--connect",
"--innodb_initialized",
]
2024-01-17 16:11:36 +00:00
interval: "${DOCKER_DB_HEALTHCHECK_INTERVAL:-10s}"
2024-01-17 15:47:39 +00:00
retries: 2
timeout: 5s
2018-05-20 13:02:29 +00:00
redis:
2024-01-17 16:11:36 +00:00
image: redis:${REDIS_VERSION:-7.2}
2024-01-06 18:01:48 +00:00
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-redis"
2019-06-03 02:53:13 +00:00
restart: unless-stopped
2024-01-17 14:41:48 +00:00
command: "${DOCKER_REDIS_CONFIG_FILE:-} --requirepass '${REDIS_PASSWORD:-}'"
2024-01-17 14:13:38 +00:00
environment:
- REDISCLI_AUTH=${REDIS_PASSWORD:-}
2024-01-06 18:01:48 +00:00
env_file:
- ".env"
2018-05-20 13:02:29 +00:00
volumes:
2024-01-06 14:19:36 +00:00
- "${DOCKER_CONFIG_ROOT}/redis:/etc/redis"
2024-01-15 23:50:16 +00:00
- "${DOCKER_REDIS_DATA_PATH}:/data"
2024-01-06 14:19:36 +00:00
ports:
2024-01-17 14:13:38 +00:00
- "${DOCKER_REDIS_PORT_EXTERNAL}:6379"
2024-01-06 14:19:36 +00:00
healthcheck:
2024-01-17 15:47:39 +00:00
test: ["CMD", "redis-cli", "-p", "6379", "ping"]
2024-01-17 16:18:29 +00:00
interval: "${DOCKER_REDIS_HEALTHCHECK_INTERVAL:-10s}"
2024-01-06 14:19:36 +00:00
retries: 2
2024-01-17 15:47:39 +00:00
timeout: 5s