version: '3.8' services: db: image: mysql:8.0 cap_add: - SYS_NICE hostname: db restart: always environment: - MYSQL_DATABASE=library - MYSQL_RANDOM_ROOT_PASSWORD=1 - MYSQL_USER=dbuser - MYSQL_PASSWORD=libraryDbPassword ports: - '3306:3306' volumes: - db:/var/lib/mysql - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql api: image: githubactionsdemo.api:${VERSION} build: . restart: always depends_on: - db ports: - '5200:5275' environment: - ASPNETCORE_URLS=http://*:5275 - API_DbSettings__ConnectionString=Server=db;Database=library;Uid=dbuser;Pwd=libraryDbPassword; volumes: db: driver: local