version: "3.7"

services:
  app_proxy:
    environment:
      APP_HOST: booklore_web_1
      APP_PORT: 6060
      
  web:
    image: booklore/booklore:v2.2.0@sha256:346064cb1fef6149dad2d8a373ea5fd1a7e3b61c22540995e40e8452136e202b
    # без рута не работает
    #user: "1000:1000"
    restart: on-failure
    environment:
      DATABASE_URL: jdbc:mariadb://booklore_db_1:3306/booklore
      DATABASE_USERNAME: bookloreuser
      DATABASE_PASSWORD: booklorepass
    depends_on:
      db:
        condition: service_started
    volumes:
      - ${APP_DATA_DIR}/data/app:/app/data
      - ${APP_DATA_DIR}/data/books:/books

  db:
    image: mariadb:12.0.2@sha256:b30cc65b57a11a2e791ad5c06284e599fe9f1bf3fe9081a88d85bcf36389be4a
    user: "1000:1000"
    restart: on-failure
    environment:
      MARIADB_DATABASE: booklore
      MARIADB_USER: bookloreuser
      MARIADB_PASSWORD: booklorepass
      MARIADB_ROOT_PASSWORD: rootpass
    volumes:
      - ${APP_DATA_DIR}/data/db:/var/lib/mysql
