chore: fix build dependencies and frontend config
Migrate Docker SDK from github.com/docker/docker (+incompatible) to github.com/moby/moby/client v0.3.0 + moby/moby/api v1.54.0 (proper Go modules). Adapt all container/image/network operations to the new moby API (Filters, ContainerListOptions, PullResponse, InspectResult, etc.). Add AsyncTriggerDeploy runDeploy method. Fix SvelteKit build: disable prerender, set strict=false for SPA, bump vite-plugin-svelte to v5 for vite 6 compat. Add .dockerignore to exclude .git, node_modules, plans.
This commit is contained in:
+23
-22
@@ -5,11 +5,10 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/moby/moby/api/types/registry"
|
||||
"github.com/moby/moby/client"
|
||||
)
|
||||
|
||||
// ImageInfo holds metadata extracted from a Docker image inspection.
|
||||
@@ -33,7 +32,7 @@ func (c *Client) PullImage(ctx context.Context, imageRef string, tag string, aut
|
||||
ref = imageRef + ":" + tag
|
||||
}
|
||||
|
||||
opts := image.PullOptions{}
|
||||
opts := client.ImagePullOptions{}
|
||||
if authConfig != "" {
|
||||
opts.RegistryAuth = authConfig
|
||||
}
|
||||
@@ -42,11 +41,10 @@ func (c *Client) PullImage(ctx context.Context, imageRef string, tag string, aut
|
||||
if err != nil {
|
||||
return fmt.Errorf("pull image %s: %w", ref, err)
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
// Drain the pull progress stream to completion.
|
||||
if _, err := io.Copy(io.Discard, reader); err != nil {
|
||||
return fmt.Errorf("read pull response for %s: %w", ref, err)
|
||||
// Wait for the pull to complete.
|
||||
if err := reader.Wait(ctx); err != nil {
|
||||
return fmt.Errorf("wait for pull of %s: %w", ref, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -54,26 +52,29 @@ func (c *Client) PullImage(ctx context.Context, imageRef string, tag string, aut
|
||||
|
||||
// InspectImage retrieves metadata from a local image.
|
||||
func (c *Client) InspectImage(ctx context.Context, imageRef string) (ImageInfo, error) {
|
||||
inspect, _, err := c.api.ImageInspectWithRaw(ctx, imageRef)
|
||||
inspectResult, err := c.api.ImageInspect(ctx, imageRef)
|
||||
if err != nil {
|
||||
return ImageInfo{}, fmt.Errorf("inspect image %s: %w", imageRef, err)
|
||||
}
|
||||
|
||||
info := ImageInfo{
|
||||
Labels: inspect.Config.Labels,
|
||||
}
|
||||
info := ImageInfo{}
|
||||
|
||||
// Extract exposed ports.
|
||||
for port := range inspect.Config.ExposedPorts {
|
||||
info.ExposedPorts = append(info.ExposedPorts, string(port))
|
||||
}
|
||||
// Extract labels from Config if available.
|
||||
if inspectResult.Config != nil {
|
||||
info.Labels = inspectResult.Config.Labels
|
||||
|
||||
// Extract healthcheck command.
|
||||
if inspect.Config.Healthcheck != nil && len(inspect.Config.Healthcheck.Test) > 0 {
|
||||
// The Test slice is ["CMD", "arg1", "arg2", ...] or ["CMD-SHELL", "cmd string"].
|
||||
// Join all parts after the first element for a readable representation.
|
||||
if len(inspect.Config.Healthcheck.Test) > 1 {
|
||||
info.Healthcheck = joinArgs(inspect.Config.Healthcheck.Test[1:])
|
||||
// Extract exposed ports from OCI config (map[string]struct{}).
|
||||
for port := range inspectResult.Config.ExposedPorts {
|
||||
info.ExposedPorts = append(info.ExposedPorts, port)
|
||||
}
|
||||
|
||||
// Extract healthcheck command.
|
||||
if inspectResult.Config.Healthcheck != nil && len(inspectResult.Config.Healthcheck.Test) > 0 {
|
||||
// The Test slice is ["CMD", "arg1", "arg2", ...] or ["CMD-SHELL", "cmd string"].
|
||||
// Join all parts after the first element for a readable representation.
|
||||
if len(inspectResult.Config.Healthcheck.Test) > 1 {
|
||||
info.Healthcheck = joinArgs(inspectResult.Config.Healthcheck.Test[1:])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user