services: homeassistant: container_name: home-assistant image: ghcr.io/home-assistant/home-assistant:stable volumes: - /path/to/home-assistant/config:/config - /etc/localtime:/etc/localtime:ro environment: - PUID=${PUID} - PGID=${PGID} - TZ=${TZ} restart: unless-stopped ports: - "${HTTP_PORT}:8123" depends_on: homeassistant-db: condition: service_healthy privileged: true healthcheck: test: [ "CMD-SHELL", "curl -fsS -o /dev/null -w '%{http_code}' http://127.0.0.1:8123/api/ | grep -q 401", ] interval: 30s timeout: 10s retries: 10 start_period: 90s networks: - home-assistant-net homeassistant-db: container_name: homeassistant-db image: postgres:latest restart: unless-stopped environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_INITDB_ARGS=--encoding=UTF-8 --locale=en_US.UTF-8 volumes: - /path/to/home-assistant/schemas:/var/lib/postgresql security_opt: - no-new-privileges:true healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 10 start_period: 10s networks: - home-assistant-net networks: home-assistant-net: external: true