fix flake + container subcommand

This commit is contained in:
Quentin 2023-04-28 12:05:22 +02:00
parent b40d496096
commit 33bd6e1451
Signed by: quentin
GPG key ID: E9602264D639FF68
2 changed files with 40 additions and 2 deletions

38
cmd/container.go Normal file
View file

@ -0,0 +1,38 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
const distributionPrefix = "v2"
//---
//--- Command logic
var containerCmd = &cobra.Command{
Use: "container",
Short: "Manage container images",
Long: "Publish software on an S3 target following the OCI specification",
}
var containerTag string
var containerPublishCmd = &cobra.Command{
Use: "push [folder] [remote]", // https://gocloud.dev/howto/blob/#s3-compatible
Short: "Publish a container image",
Long: "Copy .tar.gz files in the specified folder on the S3 target so that they match the OCI distribution specification",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("✅ push succeeded\n")
},
}
func init() {
containerPublishCmd.Flags().StringVarP(&containerTag, "tag", "t", "", "Tag of the project, eg. albatros:0.9")
containerPublishCmd.MarkFlagRequired("tag")
containerCmd.AddCommand(containerPublishCmd)
RootCmd.AddCommand(containerCmd)
}

View file

@ -39,7 +39,7 @@
}).overrideAttrs (old: old // { GOOS = "linux"; GOARCH = arch; }); }).overrideAttrs (old: old // { GOOS = "linux"; GOARCH = arch; });
# logic to build docker containers # logic to build docker containers
docker = staticBin: arch: pkgs.dockerTools.buildImage { dockerImg = staticBin: arch: pkgs.dockerTools.buildImage {
name = "dxflrs/albatros"; name = "dxflrs/albatros";
architecture = arch; architecture = arch;
config = { config = {
@ -58,7 +58,7 @@
# generate packages for each architecture # generate packages for each architecture
packages = builtins.mapAttrs (name: value: rec { packages = builtins.mapAttrs (name: value: rec {
albatros = (albatrosStaticBin value); albatros = (albatrosStaticBin value);
docker.albatros = (docker albatros value); docker.albatros = (dockerImg albatros value);
default = albatros; default = albatros;
}) archmap; }) archmap;
in in