services: db: image: postgres:17-alpine ports: - 5432 environment: - POSTGRES_USER=listmonk - POSTGRES_PASSWORD=listmonk - POSTGRES_DB=listmonk restart: unless-stopped healthcheck: test: [ "CMD-SHELL", "pg_isready -U listmonk" ] interval: 10s timeout: 5s retries: 6 volumes: - listmonk-data:/var/lib/postgresql/data app: restart: unless-stopped image: listmonk/listmonk:v5.0.0 environment: - LISTMONK_app__address=0.0.0.0:9000 - LISTMONK_db__user=listmonk - LISTMONK_db__password=listmonk - LISTMONK_db__database=listmonk - LISTMONK_db__host=db - LISTMONK_db__port=5432 - LISTMONK_db__ssl_mode=disable - LISTMONK_db__max_open=25 - LISTMONK_db__max_idle=25 - LISTMONK_db__max_lifetime=300s - TZ=Etc/UTC depends_on: - db command: [ sh, -c, "./listmonk --install --idempotent --yes --config '' && ./listmonk --upgrade --yes --config '' && ./listmonk --config ''" ] # --config (file) param is set to empty so that listmonk only uses the env vars (below) for config. # --install --idempotent ensures that DB installation happens only once on an empty DB, on the first ever start. # --upgrade automatically runs any DB migrations when a new image is pulled. volumes: - ../files/config.toml:/listmonk/config.toml - listmonk-uploads:/listmonk/uploads volumes: listmonk-uploads: listmonk-data: driver: local