62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
# ---------------------------------------------------------------
|
|
# IPAM — Docker Compose
|
|
# ---------------------------------------------------------------
|
|
# Deux profils :
|
|
# - `sqlite` → ipam seul, base dans un volume
|
|
# - `postgres` → ipam + postgres
|
|
#
|
|
# Usage :
|
|
# docker compose --profile sqlite up -d
|
|
# docker compose --profile postgres up -d
|
|
# ---------------------------------------------------------------
|
|
|
|
services:
|
|
ipam:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile
|
|
container_name: ipam
|
|
restart: unless-stopped
|
|
# Network mode host : indispensable pour ARP / mDNS / ping sweep
|
|
# sur le réseau local. Commenter cette ligne si non nécessaire.
|
|
network_mode: host
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3000
|
|
env_file:
|
|
- ../.env
|
|
volumes:
|
|
- ipam-data:/app/data
|
|
# Capabilities requises pour le ping ICMP raw
|
|
cap_add:
|
|
- NET_RAW
|
|
- NET_ADMIN
|
|
profiles: [sqlite, postgres]
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
required: false
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: ipam-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ipam
|
|
POSTGRES_PASSWORD: ipam
|
|
POSTGRES_DB: ipam
|
|
volumes:
|
|
- ipam-postgres:/var/lib/postgresql/data
|
|
ports:
|
|
- '5432:5432'
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U ipam']
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
profiles: [postgres]
|
|
|
|
volumes:
|
|
ipam-data:
|
|
ipam-postgres:
|