mirror of
https://github.com/hanzoai/runtime.git
synced 2026-10-30 18:23:13 +00:00
- Add main Dockerfile for production builds - Add Dockerfile.runtime for secure code execution - Add Dockerfile.runtime.fixed with improved configuration - Include .dockerignore for build optimization - Add integration documentation and publishing guides - Update API and CLI components for better runtime support - Enhance sandbox and container management features
39 lines
874 B
Go
39 lines
874 B
Go
// Copyright 2025 Hanzo Industries Inc.
|
|
// SPDX-License-Identifier: AGPL-3.0
|
|
|
|
package docker
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/hanzoai/runner/internal/util"
|
|
"github.com/hanzoai/runner/pkg/api/dto"
|
|
|
|
"github.com/docker/docker/api/types/image"
|
|
"github.com/docker/docker/pkg/jsonmessage"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func (d *DockerClient) PushImage(ctx context.Context, imageName string, reg *dto.RegistryDTO) error {
|
|
log.Infof("Pushing image %s...", imageName)
|
|
|
|
responseBody, err := d.apiClient.ImagePush(ctx, imageName, image.PushOptions{
|
|
RegistryAuth: getRegistryAuth(reg),
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer responseBody.Close()
|
|
|
|
err = jsonmessage.DisplayJSONMessagesStream(responseBody, io.Writer(&util.DebugLogWriter{}), 0, true, nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
log.Infof("Image %s pushed successfully", imageName)
|
|
|
|
return nil
|
|
}
|