version: "3.8"
services:
  php:
    build:
      context: ./
      dockerfile: Dockerfile
    container_name: web-server_php
    restart: always
    ports:
      - 80:80
    volumes:
      - ./html:/var/www/html
      - ./config:/usr/local/etc/php
    networks:
      - web-server_network
    depends_on:
      - mysql
  mysql:
    image: mysql:8.2.0
    container_name: web-server_mysql
    environment:
      MYSQL_ROOT_PASSWORD: debian
      MYSQL_DATABASE: debian
      MYSQL_USER: debian
      MYSQL_PASSWORD: debian
    ports:
      - "3306:3306"
    volumes:
      - ./mysql-data:/var/lib/mysql
    networks:
      - web-server_network
  phpmyadmin:
    image: phpmyadmin:5.2.1
    container_name: web-server_phpmyadmin
    restart: always
    ports:
      - 8080:80
    environment:
      - PMA_HOST=mysql
      - PMA_PORT=3306
      - PMA_ARBITRARY=1
      - MYSQL_ROOT_PASSWORD=root
    depends_on:
      - mysql
    networks:
      - web-server_network
  sftp:
    image: atmoz/sftp
    container_name: web-server_sftp
    volumes:
      - /home/debian/web-server:/home/test/web-server
    ports:
      - "2222:22"
    command: test:test:1001
networks:
  web-server_network:
    driver: bridge
volumes:
  html: {}
  config: {}
  mysql_data: {}