github.com/apptainer/singularity@v3.1.1+incompatible/cmd/internal/cli/build_darwin.go (about) 1 // Copyright (c) 2018, Sylabs Inc. All rights reserved. 2 // This software is licensed under a 3-clause BSD license. Please consult the 3 // LICENSE.md file distributed with the sources of this project regarding your 4 // rights to use or distribute this software. 5 6 package cli 7 8 import ( 9 "context" 10 "os" 11 12 "github.com/spf13/cobra" 13 "github.com/sylabs/singularity/internal/pkg/build/remotebuilder" 14 "github.com/sylabs/singularity/internal/pkg/sylog" 15 ) 16 17 func run(cmd *cobra.Command, args []string) { 18 dest := args[0] 19 spec := args[1] 20 21 // check if target collides with existing file 22 if ok := checkBuildTarget(dest, false); !ok { 23 os.Exit(1) 24 } 25 26 if !remote { 27 sylog.Fatalf("Only remote builds are supported on this platform") 28 } 29 30 // Submiting a remote build requires a valid authToken 31 if authToken == "" { 32 sylog.Fatalf("Unable to submit build job: %v", authWarning) 33 } 34 35 def, err := definitionFromSpec(spec) 36 if err != nil { 37 sylog.Fatalf("Unable to build from %s: %v", spec, err) 38 } 39 40 b, err := remotebuilder.New(dest, libraryURL, def, detached, force, builderURL, authToken) 41 if err != nil { 42 sylog.Fatalf("Failed to create builder: %v", err) 43 } 44 45 err = b.Build(context.TODO()) 46 if err != nil { 47 sylog.Fatalf("While performing build: %v", err) 48 } 49 }