version: '3.1'

services:
  nginx:
    container_name: nginx_ssl_proxy
    image: nginx:alpine
    ports:
      - "8085:80"
      - "4443:443"
    volumes:
      - ./nginx_conf:/etc/nginx/conf.d
      - ./ssl_certs:/etc/ssl/certs
    depends_on:
      - web

  web:
    build:
      context: .
      dockerfile: Dockerfile
    image: php:apache
    ports:
      - "8084:80"
    volumes:
      - ./src:/var/www/html
    depends_on:
      - mysql
    networks:
      - laravel

  db:
    image: mysql:latest
    container_name: mysql
    restart: always
    tty: true
    environment:
      MYSQL_ROOT_USER: root
      MYSQL_DATABASE: laravel
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_ROOT_HOST: localhost
    ports:
      - "4306:3306"
    volumes:
      - ./db_data:/var/lib/mysql
    networks:
      - laravel

networks:
  laravel:
    driver: bridge