This repository has been archived on 2026-03-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mcdeploy/push.go
Kyle Isom 8cd32cbb1c Initial implementation of mcdeploy deployment tool
Single Go binary with five commands:
- build: podman build locally with registry tags + git version
- push: podman push to MCR
- deploy: SSH pull/stop/rm/run on target node
- cert renew: issue TLS cert from Metacrypt via REST API
- status: show container status on a node

Config-driven via TOML service registry describing images,
Dockerfiles, container configs per node. Shells out to podman
for container operations and ssh for remote access.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 00:01:15 -07:00

52 lines
1017 B
Go

package main
import (
"fmt"
"github.com/spf13/cobra"
)
func pushCommand() *cobra.Command {
var imageFlag string
cmd := &cobra.Command{
Use: "push <service>",
Short: "Push container images to the registry",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cfg, err := loadCfg()
if err != nil {
return err
}
svc, err := cfg.FindService(args[0])
if err != nil {
return err
}
images := svc.Images
if imageFlag != "" {
images = []string{imageFlag}
}
var pushed []string
for _, image := range images {
ref := cfg.ImageRef(image) + ":latest"
if err := run("podman", "push", ref); err != nil {
return fmt.Errorf("push %s: %w", image, err)
}
pushed = append(pushed, ref)
}
fmt.Printf("\nPushed %d image(s):\n", len(pushed))
for _, ref := range pushed {
fmt.Printf(" %s\n", ref)
}
return nil
},
}
cmd.Flags().StringVar(&imageFlag, "image", "", "push only this image")
return cmd
}