Launch DeepCode via Docker
()
| 480 | |
| 481 | |
| 482 | def launch_docker(): |
| 483 | """Launch DeepCode via Docker""" |
| 484 | current_dir, compose_file, compose_args = _check_docker_prerequisites() |
| 485 | |
| 486 | print("๐ณ Starting DeepCode with Docker...") |
| 487 | print("=" * 50) |
| 488 | |
| 489 | try: |
| 490 | # Check if image exists (auto-build on first run) |
| 491 | result = subprocess.run( |
| 492 | compose_args + ["images", "-q"], capture_output=True, text=True |
| 493 | ) |
| 494 | if not result.stdout.strip(): |
| 495 | print( |
| 496 | "๐ฆ First run detected โ building Docker image (may take a few minutes)..." |
| 497 | ) |
| 498 | subprocess.run(compose_args + ["build"], check=True) |
| 499 | |
| 500 | # Start (if already running, docker compose will detect and skip) |
| 501 | subprocess.run(compose_args + ["up", "-d"], check=True) |
| 502 | |
| 503 | print("") |
| 504 | print("=" * 50) |
| 505 | print("โ DeepCode is running!") |
| 506 | print("") |
| 507 | print(" ๐ Open: http://localhost:8000") |
| 508 | print(" ๐ Docs: http://localhost:8000/docs") |
| 509 | print("") |
| 510 | print(" ๐ View logs: docker logs deepcode -f") |
| 511 | print( |
| 512 | " ๐ Stop: docker compose -f deepcode_docker/docker-compose.yml down" |
| 513 | ) |
| 514 | print("=" * 50) |
| 515 | |
| 516 | except subprocess.CalledProcessError as e: |
| 517 | print(f"\nโ Docker failed: {e}") |
| 518 | sys.exit(1) |
| 519 | except KeyboardInterrupt: |
| 520 | print("\n๐ Cancelled") |
| 521 | |
| 522 | |
| 523 | def launch_docker_cli(): |
no test coverage detected