services: redis: image: redis:latest container_name: redis env_file: - .env ports: - "6379:6379" command: ["redis-server", "--requirepass", "$REDIS_PASSWORD"] healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 db: image: mysql:8.0 container_name: mysql env_file: - .env environment: MYSQL_ROOT_PASSWORD: $DB_PASSWORD MYSQL_DATABASE: $DB_NAME MYSQL_USER: $DB_USER MYSQL_PASSWORD: $DB_PASSWORD ports: - "3306:3306" volumes: - db_data:/var/lib/mysql - ./init.sql:/docker-entrypoint-initdb.d/init.sql - ./my.cnf:/etc/mysql/conf.d/my.cnf healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 10s timeout: 5s retries: 5 web: container_name: imaginar build: context: ./ dockerfile: ./Dockerfile ports: - "3000:3000" volumes: - ./:/app - /app/node_modules environment: NODE_ENV: development DB_HOST: $DB_HOST DB_PORT: $DB_PORT DB_USER: $DB_USER DB_PASSWORD: $DB_PASSWORD DB_NAME: $DB_NAME command: npm run dev depends_on: redis: condition: service_healthy db: condition: service_healthy volumes: db_data: