# Askarr — web, bot and Postgres. # # `docker compose up -d` pulls the published image and starts everything. # `docker compose up -d --build` builds from this checkout instead, which is # what you want when you are working on the code. # # `web` and `bot` are the same image with different commands. Building once # keeps the two halves on exactly the same code and schema. x-askarr: &askarr image: ghcr.io/gothub97/askarr:${ASKARR_TAG:-latest} build: context: . dockerfile: docker/Dockerfile restart: unless-stopped environment: &askarr-env DATABASE_URL: ${DATABASE_URL} APP_URL: ${APP_URL} TZ: ${TZ:-UTC} services: postgres: image: postgres:17-alpine restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-askarr} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-askarr} POSTGRES_DB: ${POSTGRES_DB:-askarr} volumes: - askarr-postgres:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-askarr} -d ${POSTGRES_DB:-askarr}"] interval: 5s timeout: 5s retries: 10 start_period: 10s web: <<: *askarr depends_on: postgres: condition: service_healthy environment: <<: *askarr-env BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET} BETTER_AUTH_URL: ${BETTER_AUTH_URL:-${APP_URL}} # Seeds a fresh install only. Once a token is saved in the back office # the database is the source of truth and this is ignored. TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-} ports: - "${WEB_PORT:-3000}:3000" # The web process owns migrations; the bot never runs them, so the two # cannot race to apply the same migration on start-up. command: sh -c "npm run db:migrate && npm run start" bot: <<: *askarr depends_on: postgres: condition: service_healthy web: condition: service_started environment: <<: *askarr-env TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-} command: npm run start:bot volumes: askarr-postgres: