Add database auto-start configuration for development
This commit is contained in:
24
docker-compose.dev.yml
Normal file
24
docker-compose.dev.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:8.0
|
||||||
|
container_name: petshop-db
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
MYSQL_DATABASE: Petstoredb
|
||||||
|
MYSQL_USER: petshop
|
||||||
|
MYSQL_PASSWORD: petshop
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
- ./src/main/resources/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
|
||||||
|
- ./src/main/resources/data.sql:/docker-entrypoint-initdb.d/02-data.sql
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-proot"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 30
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db_data:
|
||||||
Reference in New Issue
Block a user