Docker-Swarm-Loadbalancer/docker-compose.yml
2024-06-21 16:21:39 +02:00

73 lines
1.8 KiB
YAML

networks:
default:
services:
loadbalancer:
build:
context: .
target: loadbalancer
additional_contexts:
- php:cli=docker-image://ghcr.io/benzine-framework/php:cli-8.2
args:
PUBLIC_MAINTAINER: "Matthew Baggett <test@baggett.me>"
SOURCE_URL: "https://git.grey.ooo/Benzine/docker-swarm-loadbalancer"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
image: loadbalancer-test
networks:
default:
aliases:
- a.example.org
- b.example.org
- plural.example.org
- redirect-to-ssl.example.org
- nope.example.org
depends_on:
web-a:
condition: service_healthy
web-b:
condition: service_healthy
web-redirect-ssl:
condition: service_healthy
web-plural:
condition: service_healthy
web-a: &web
build:
context: .
target: test-app
additional_contexts:
- php:nginx=docker-image://ghcr.io/benzine-framework/php:nginx-8.2
environment:
- BOUNCER_DOMAIN=a.example.org
- BOUNCER_TARGET_PORT=80
- SITE_NAME=A
networks:
- default
web-b:
<<: *web
environment:
- BOUNCER_DOMAIN=b.example.org
- BOUNCER_TARGET_PORT=80
- SITE_NAME=B
web-plural:
<<: *web
environment:
- BOUNCER_DOMAIN=plural.example.org
- BOUNCER_TARGET_PORT=80
- SITE_NAME=plural
deploy:
replicas: 3
web-redirect-ssl:
<<: *web
environment:
- BOUNCER_DOMAIN=redirect-to-ssl.example.org
- BOUNCER_TARGET_PORT=80
- SITE_NAME=redirect-to-ssl
- BOUNCER_ALLOW_NON_SSL=false
test-box:
build:
context: .
target: test-box
command: ["tail", "-f", "/dev/null"]
networks:
- default