services: postgres: container_name: postgres image: postgres:16.3-alpine3.19 restart: always networks: - proxynet env_file: - ./secrets/vars.env environment: PG_DATA: /var/lib/postgresql/data POSTGRES_USER: admin POSTGRES_DB: postgres volumes: - ./data/pgdata:/var/lib/postgresql/data - ./init-db/init-database.sh:/docker-entrypoint-initdb.d/init-database.sh labels: - "traefik.enable=true" - "traefik.tcp.routers.postgresql.rule=HostSNI(`*`)" - "traefik.tcp.services.postgresql.loadbalancer.server.port=5432" - "traefik.tcp.routers.postgresql.entrypoints=postgres" initContainers: container_name: volume-permissions image: busybox:1.36.1-glibc command: > sh -c "chmod 755 /init-db/init-database.sh" volumes: - ./init-db:/init-db networks: proxynet: external: true