

version: "3.9"
services:
  web:
    image: frontend
    build: ../frontend
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    ports:
      - "3000:3000"
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD:
      MYSQL_DATABASE: development
      MYSQL_ALLOW_EMPTY_PASSWORD: 1
    ports:
      - "3307:3306"
  backend:
    image: backend
    volumes:
    - ./wait-for-it.sh:/usr/src/app/wait-for-it.sh
    - ./start-backend.sh:/usr/src/app/start-backend.sh
    build: ../backend
    environment:
     - DEV_DB_HOST=db
    ports:
     - "8080:8080"
    depends_on:
     - "db"

    command: ["bash", "./wait-for-it.sh", "db:3306", "--timeout=0", "--strict", "--", "bash", "./start-backend.sh"]

