version: '2.1'

services:
  sshportal:
    build: ../..
    restart: unless-stopped
    depends_on:
      mysql:
        condition: service_healthy
    links:
      - mysql
    command: server --db-driver=mysql --debug --db-conn="root:root@tcp(mysql:3306)/db?charset=utf8&parseTime=true&loc=Local"
    ports:
      - 2222:2222

  mysql:
    image: mysql:latest
    ports:
      - 3306
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=db
    restart: unless-stopped
    command: --log-error-verbosity=3
    healthcheck:
      test: ["CMD-SHELL", "echo SELECT 1 | mysql -h127.0.0.1 -uroot -proot"]
      interval: 5s
      timeout: 5s
      retries: 5