I've to write docker compose for importing mysql file of size 1.5gb inside container. Also my backend should wait for the mysql import to complete also next build it should not import data my docker-compose file
mysql:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 12345@root
MYSQL_DATABASE: dockerDB
volumes:
- ./mysql_data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/datadump.sql
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"-uroot",
"-p12345@root"
]
networks:
- local_net
backend:
build: ./Backend/
image: rails_backend
container_name: backend
restart: always
ports:
- 3000:3000
depends_on:
mysql:
condition: service_healthy
networks:
- local_net
env_file:
- ./Backend/.env
command: /root/.rbenv/shims/rails s -p 3000 -b '0.0.0.0'
i have tried health check using healthcheck: test: [ "CMD", "mysqladmin", "ping", "-uroot", "-p12345@root" ] but when i hit backend it crash as mysql has not imported all data