Files
runtime/apps/runner/pkg/docker/image_push.go
zeekay ea80dc3638 feat: Add new Dockerfiles and improve containerization
- 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
2025-08-16 23:03:39 -05:00

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
}