services:
  db:
    env_file:
      - .env
    image: "mysql:${MYSQL_VERSION}"
    container_name: ${MYSQL_CONTAINER}
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=${PASSW}
      - MYSQL_DATABASE=${DB}
      - MYSQL_USER=${USER}
      - MYSQL_PASSWORD=${PASSW}
    ports:
      - "${PORT}:3306"
    volumes:
      - my_data:/var/lib/mysql
    healthcheck:
      test: mysqladmin ping -h ${HOST} -u $${USER} --password=$${PASSW}
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 55

volumes:
  my_data:
