version: '3'
services:
  nginx:
    image: nginx:alpine
    volumes:
      - './conf/nginx:/etc/nginx'
      - './static:/var/www/html'
    restart: always
    ports:
      - '${APP_PORT:-80}:80'
    networks:
      pairent:
        aliases:
          - nginx
    depends_on:
      - back
  back:
    build:
      context: ./pairent_backend
      dockerfile: Dockerfile
    networks:
      pairent:
        aliases:
          - back
    volumes:
      - './pairent_backend:/opt/code'
    environment:
      DB_PASS: '${DB_PASSWORD}'
    depends_on:
      - db
  db:
    image: mariadb
    networks:
      pairent:
        aliases:
          - db
    volumes:
      - './data/db:/etc/mysql'
    environment:
      MARIADB_ROOT_PASSWORD: '${DB_PASSWORD}'
      MARIADB_DATABASE: 'pairent_db'

networks:
  pairent:
    driver: bridge