version: '3.1'

services:
  photolist:
    restart: always
    build:
      context: ../.
      dockerfile: build/Dockerfile.Multistage
    image: photolist:latest
    links:
      - dbMysql:dbMysql
    ports:
      - 8080:8080
    volumes:
      - ../images:/app/images
    depends_on:
      - "dbMysql"
    command: ["/app/wait-for-it.sh", "dbMysql:3306", "--", "/app/photolist"]

  dbMysql:
    image: mariadb:10.7
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    ports:
      - 3306:3306
    volumes:
      # paths relative to docker-compose files
      - './_mysql/:/docker-entrypoint-initdb.d/'
      # - ../tmp/mysql:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: "love"
      MYSQL_DATABASE: photolist

  nginx:
    image: nginx:1.17
    links:
      - photolist:photolist
    depends_on:
      - "photolist"
    volumes:
      - ../configs/nginx:/etc/nginx/conf.d
    ports:
      - 8081:80

  adminer:
    image: adminer
    restart: always
    ports:
      - 8090:8080