pixelfed/docker-compose.yml
2024-01-06 18:01:48 +00:00

123 lines
3.8 KiB
YAML

---
version: "3"
###############################################################
# Please see docker/README.md for usage information
###############################################################
services:
# HTTP/HTTPS proxy
#
# See: https://github.com/nginx-proxy/nginx-proxy/tree/main/docs
proxy:
image: nginxproxy/nginx-proxy:1.4
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-proxy"
#restart: unless-stopped
volumes:
- "${DOCKER_HOST_SOCKET_PATH}:/tmp/docker.sock:ro"
- "${DOCKER_CONFIG_ROOT}/proxy/conf.d:/etc/nginx/conf.d"
- "${DOCKER_CONFIG_ROOT}/proxy/vhost.d:/etc/nginx/vhost.d"
- "${DOCKER_CONFIG_ROOT}/proxy/certs:/etc/nginx/certs"
- "${DOCKER_DATA_ROOT}/proxy/html:/usr/share/nginx/html"
ports:
- "${DOCKER_PROXY_PORT_EXTERNAL_HTTP}:80"
- "${DOCKER_PROXY_PORT_EXTERNAL_HTTPS}:443"
# Proxy companion for managing letsencrypt SSL certificates
#
# See: https://github.com/nginx-proxy/acme-companion/tree/main/docs
proxy-acme:
image: nginxproxy/acme-companion
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-proxy-acme"
#restart: unless-stopped
environment:
DEBUG: 0
DEFAULT_EMAIL: "${LETSENCRYPT_EMAIL}"
NGINX_PROXY_CONTAINER: "${DOCKER_CONTAINER_NAME_PREFIX}-proxy"
depends_on:
- proxy
volumes:
- "${DOCKER_HOST_SOCKET_PATH}:/var/run/docker.sock:ro"
- "${DOCKER_CONFIG_ROOT}/proxy/conf.d:/etc/nginx/conf.d"
- "${DOCKER_CONFIG_ROOT}/proxy/vhost.d:/etc/nginx/vhost.d"
- "${DOCKER_CONFIG_ROOT}/proxy/certs:/etc/nginx/certs"
- "${DOCKER_DATA_ROOT}/proxy/html:/usr/share/nginx/html"
- "${DOCKER_DATA_ROOT}/proxy-acme:/etc/acme.sh"
web:
image: "${DOCKER_IMAGE}:${DOCKER_TAG}"
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-web"
restart: unless-stopped
build:
target: apache-runtime
deploy:
mode: replicated
replicas: 1
volumes:
- "./.env:/var/www/.env"
- "${DOCKER_DATA_ROOT}/pixelfed/cache:/var/www/bootstrap/cache"
- "${DOCKER_DATA_ROOT}/pixelfed/storage:/var/www/storage"
environment:
LETSENCRYPT_HOST: "${LETSENCRYPT_HOST}"
LETSENCRYPT_EMAIL: "${LETSENCRYPT_EMAIL}"
LETSENCRYPT_TEST: "${LETSENCRYPT_TEST}"
VIRTUAL_HOST: "${APP_DOMAIN}"
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
# ports:
# - "${DOCKER_WEB_HTTP_PORT_EXTERNAL}:80"
# - "${DOCKER_WEB_HTTPS_PORT_EXTERNAL}:443"
depends_on:
- db
- redis
worker:
image: "${DOCKER_IMAGE}:${DOCKER_TAG}"
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-worker"
command: gosu www-data php artisan horizon
restart: unless-stopped
deploy:
mode: replicated
replicas: 1
build:
target: apache-runtime
volumes:
- "./.env:/var/www/.env"
- "${DOCKER_DATA_ROOT}/pixelfed/cache:/var/www/bootstrap/cache"
- "${DOCKER_DATA_ROOT}/pixelfed/storage:/var/www/storage"
depends_on:
- db
- redis
db:
image: mariadb:11.2
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-db"
command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped
env_file:
- ".env"
volumes:
- "${DOCKER_DATA_ROOT}/db:/var/lib/mysql"
ports:
- "${DOCKER_DB_PORT_EXTERNAL}:3306"
redis:
image: redis:7
container_name: "${DOCKER_CONTAINER_NAME_PREFIX}-redis"
restart: unless-stopped
env_file:
- ".env"
volumes:
- "${DOCKER_CONFIG_ROOT}/redis:/etc/redis"
- "${DOCKER_DATA_ROOT}/redis:/data"
ports:
- "${DOCKER_REDIS_PORT_EXTERNAL}:6399"
healthcheck:
interval: 10s
timeout: 5s
retries: 2
test: ["CMD", "redis-cli", "-p", "6399", "ping"]