version: "3.8"

services:
  db:
    image: mysql:latest
    container_name: ${DB_ENDPOINT}
    ports:
      - ${DB_EXTERNAL_PORT}:${DB_PORT}
    expose:
      - ${DB_PORT}
    cap_add:
      - SYS_NICE
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      TZ: Asia/Tokyo
    networks:
      - network
    volumes:
      - ./db/conf:/etc/mysql/conf.d
      - ./db/init:/docker-entrypoint-initdb.d
      - mysql-data:/var/lib/mysql

  cache:
    image: redis:latest
    container_name: redis-cache
    ports:
      - 8000:8000
    expose:
      - 8000
    networks:
      - network
    volumes:
      - ./cache:/data
networks:
  network:
    internal: false
    name: omds_network

volumes:
  mysql-data:
