services:
  db:
    image: docker.io/library/mariadb:11.5.2
    container_name: ${MYSQL_HOST}
    restart: always
    ports:
      - 127.0.0.1:${MYSQL_PORT}:3306
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}

  phpmyadmin:
    image: docker.io/library/phpmyadmin
    container_name: fecharts_phpmyadmin
    links:
      - ${MYSQL_HOST}
    restart: unless-stopped
    ports:
      - 127.0.0.1:${PHPMYADMIN_PORT}:80
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=${MYSQL_HOST}
      - PMA_PORT=${MYSQL_PORT}

  api:
    image: odari/fecharts_api:1.0.0
    container_name: fecharts_api
    links:
      - ${MYSQL_HOST}
    restart: always
    ports:
      - 127.0.0.1:${FECHARTS_API_PORT}:80
    environment:
      - MYSQL_HOST=${MYSQL_HOST}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_PORT=${MYSQL_PORT}
