@@ -325,34 +325,37 @@ def push(
325325 ] = False ,
326326) -> None :
327327 """
328- Push an OpenEnv environment to Hugging Face Spaces or a custom registry.
328+ Push an OpenEnv environment to Hugging Face Spaces or a custom Docker registry.
329329
330330 This command:
331331 1. Validates that the directory is an OpenEnv environment (openenv.yaml present)
332- 2. Prepares a custom build for deployment (optionally enables web interface)
333- 3. Uploads to Hugging Face or custom registry
332+ 2. Builds and pushes to Hugging Face Spaces or custom Docker registry
333+ 3. Optionally enables web interface for deployment
334334
335335 The web interface is enabled by default when pushing to HuggingFace Spaces,
336- but disabled by default when pushing to a custom registry.
336+ but disabled by default when pushing to a custom Docker registry.
337337
338338 Examples:
339- # Push from current directory with web interface (default )
339+ # Push to HuggingFace Spaces from current directory ( web interface enabled )
340340 $ cd my_env
341341 $ openenv push
342342
343- # Push without web interface
343+ # Push to HuggingFace without web interface
344344 $ openenv push --no-interface
345345
346- # Push to custom registry (web interface disabled by default)
346+ # Push to Docker Hub
347347 $ openenv push --registry docker.io/myuser
348348
349+ # Push to GitHub Container Registry
350+ $ openenv push --registry ghcr.io/myorg
351+
349352 # Push to custom registry with web interface
350- $ openenv push --registry docker .io/myuser --interface
353+ $ openenv push --registry myregistry .io/path1/path2 --interface
351354
352355 # Push to specific HuggingFace repo
353356 $ openenv push --repo-id my-org/my-env
354357
355- # Push with custom base image and private
358+ # Push privately with custom base image
356359 $ openenv push --private --base-image ghcr.io/meta-pytorch/openenv-base:latest
357360 """
358361 # Handle interface flag logic
@@ -402,49 +405,45 @@ def push(
402405
403406 # Handle custom registry push
404407 if registry :
405- console .print ("[bold cyan]Preparing files for custom registry deployment ...[/bold cyan]" )
408+ console .print ("[bold cyan]Preparing to push to custom registry...[/bold cyan]" )
406409 if enable_interface :
407410 console .print ("[bold cyan]Web interface will be enabled[/bold cyan]" )
408411
409- with tempfile .TemporaryDirectory () as tmpdir :
410- staging_dir = Path (tmpdir ) / "staging"
411- _prepare_staging_directory (
412- env_dir , env_name , staging_dir ,
413- base_image = base_image ,
414- enable_interface = enable_interface
415- )
416-
417- # Build Docker image from staging directory
418- tag = f"{ registry } /{ env_name } "
419- console .print (f"[bold cyan]Building Docker image: { tag } [/bold cyan]" )
420-
421- # Use the build logic (could import from build.py or inline)
422- from .build import _build_docker_image
423-
424- success = _build_docker_image (
425- env_path = staging_dir ,
426- tag = tag ,
427- context_path = staging_dir / "server" ,
428- )
429-
430- if not success :
431- console .print ("[bold red]✗ Docker build failed[/bold red]" )
432- raise typer .Exit (1 )
433-
434- console .print ("[bold green]✓ Docker build successful[/bold green]" )
435-
436- # Push to registry
437- console .print (f"[bold cyan]Pushing to registry: { registry } [/bold cyan]" )
438- from .build import _push_docker_image
439-
440- success = _push_docker_image (tag , registry = None ) # Tag already includes registry
441-
442- if not success :
443- console .print ("[bold red]✗ Docker push failed[/bold red]" )
444- raise typer .Exit (1 )
445-
446- console .print ("\n [bold green]✓ Deployment complete![/bold green]" )
447- console .print (f"Image: { tag } " )
412+ # Import build functions
413+ from .build import _build_docker_image , _push_docker_image
414+
415+ # Prepare build args for custom registry deployment
416+ build_args = {}
417+ if enable_interface :
418+ build_args ["ENABLE_WEB_INTERFACE" ] = "true"
419+
420+ # Build Docker image from the environment directory
421+ tag = f"{ registry } /{ env_name } "
422+ console .print (f"[bold cyan]Building Docker image: { tag } [/bold cyan]" )
423+
424+ success = _build_docker_image (
425+ env_path = env_dir ,
426+ tag = tag ,
427+ build_args = build_args if build_args else None ,
428+ )
429+
430+ if not success :
431+ console .print ("[bold red]✗ Docker build failed[/bold red]" )
432+ raise typer .Exit (1 )
433+
434+ console .print ("[bold green]✓ Docker build successful[/bold green]" )
435+
436+ # Push to registry
437+ console .print (f"[bold cyan]Pushing to registry: { registry } [/bold cyan]" )
438+
439+ success = _push_docker_image (tag , registry = None ) # Tag already includes registry
440+
441+ if not success :
442+ console .print ("[bold red]✗ Docker push failed[/bold red]" )
443+ raise typer .Exit (1 )
444+
445+ console .print ("\n [bold green]✓ Deployment complete![/bold green]" )
446+ console .print (f"[bold]Image:[/bold] { tag } " )
448447 return
449448
450449 # Ensure authentication for HuggingFace
0 commit comments