Files
dnsmasq-webui/docker-compose.test.yml
T

47 lines
1.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Run the app with real dnsmasq and a DHCP client so hosts/leases are real.
# Prepare mount: ./scripts/prepare-test-mount.sh [--prepare-only | --no-build | --recreate | --source DIR | --mount DIR]
# Or set TESTDATA_MOUNT to override the data volume (default: ./testdata-mount).
#
# app builds from Dockerfile.dnsmasq (app + dnsmasq in one container; app is main process).
# ReloadCommand/StatusCommand use pkill/pgrep (procps in image). cap_add NET_ADMIN for dnsmasq.
#
# Networks: testnet 172.28.0.0/16 so dnsmasq can hand out 172.28.0.10–50.
services:
app:
build:
context: .
dockerfile: Dockerfile.dnsmasq
ports:
- "8080:8080"
cap_add:
- NET_ADMIN
environment:
DNSMASQ_CONF: /data/dnsmasq-test.conf
Dnsmasq__HostsPath: /data/hosts
Dnsmasq__ConfigPath: /data/dnsmasq.d/dhcp.conf
Dnsmasq__LeasesPath: /data/leases
Dnsmasq__ReloadCommand: "pkill -HUP -x dnsmasq"
Dnsmasq__StatusCommand: "pgrep -x dnsmasq"
volumes:
- ${TESTDATA_MOUNT:-./testdata-mount}:/data
networks:
testnet:
ipv4_address: 172.28.0.2
# no depends_on: app is the only service the client needs
dhcp-client:
image: alpine:3.20
command: ["sh", "-c", "sleep 5 && udhcpc -i eth0 -f -n"]
networks:
testnet: {}
depends_on:
- app
networks:
testnet:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
gateway: 172.28.0.1