services:
  app:
    build:
      args:
        user: Rafael
        uid: 197610
      context: ./
      dockerfile: docker-compose/Dockerfile
    image: appdocker
    container_name: backend-app
    restart: unless-stopped
    working_dir: /var/www/
    volumes:
      - ./:/var/www
    networks:
      - appbackendnet

  db:
    image: mariadb:10.2.7
    container_name: backend-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_USER: ${DB_USERNAME}
      SERVICE_TAGS: dev
      SERVICE_NAME: mariadb
    ports:
      - "33062:3306"
    volumes:
      - ./docker-compose/mysql:/docker-entrypoint-initdb.d
    networks:
      - appbackendnet

  nginx:
    image: nginx:1.10.3-alpine
    container_name: backend-nginx
    restart: unless-stopped
    ports:
      - "8002:80"
    volumes:
      - ./:/var/www
      - ./docker-compose/nginx:/etc/nginx/conf.d
    networks:
      - appbackendnet

networks:
  appbackendnet:
    driver: bridge