feat: project-scoped Docker image prune, conflict fix, deploy toggle, access list picker
- Image prune only removes images matching project image refs, skips active instances - Add ListImagesByRef and RemoveImage to Docker client - Fix 409 conflict: use listProjects instead of duplicate POST - Add "Deploy immediately" toggle to Quick Deploy (off by default) - Replace raw access list ID with EntityPicker on project edit form - Trigger proxy resync on access list change - Fix stage form layout: single responsive row - Fix empty port default on project creation - Improve inspect error message for remote Docker
This commit is contained in:
@@ -113,6 +113,45 @@ func EncodeRegistryAuth(username, password, serverAddress string) (string, error
|
||||
return base64.URLEncoding.EncodeToString(data), nil
|
||||
}
|
||||
|
||||
// LocalImage represents a Docker image on the local machine.
|
||||
type LocalImage struct {
|
||||
ID string `json:"id"`
|
||||
Ref string `json:"ref"` // e.g., "registry/org/app:tag"
|
||||
Size int64 `json:"size"` // bytes
|
||||
}
|
||||
|
||||
// ListImagesByRef returns all local images matching a given image reference prefix.
|
||||
// For example, "registry.example.com/org/app" matches all tags of that image.
|
||||
func (c *Client) ListImagesByRef(ctx context.Context, imageBase string) ([]LocalImage, error) {
|
||||
result, err := c.api.ImageList(ctx, client.ImageListOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list images: %w", err)
|
||||
}
|
||||
|
||||
var images []LocalImage
|
||||
for _, img := range result.Items {
|
||||
for _, tag := range img.RepoTags {
|
||||
if strings.HasPrefix(tag, imageBase+":") || tag == imageBase {
|
||||
images = append(images, LocalImage{
|
||||
ID: img.ID,
|
||||
Ref: tag,
|
||||
Size: img.Size,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return images, nil
|
||||
}
|
||||
|
||||
// RemoveImage removes a single Docker image by reference (name:tag or ID).
|
||||
func (c *Client) RemoveImage(ctx context.Context, imageRef string) error {
|
||||
_, err := c.api.ImageRemove(ctx, imageRef, client.ImageRemoveOptions{PruneChildren: true})
|
||||
if err != nil {
|
||||
return fmt.Errorf("remove image %s: %w", imageRef, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// joinArgs joins string arguments with spaces.
|
||||
func joinArgs(args []string) string {
|
||||
return strings.Join(args, " ")
|
||||
|
||||
Reference in New Issue
Block a user