Skip to content

Commit

Permalink
Do not generate Dockerfile for user mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Aug 12, 2024
1 parent ae7077d commit beac7f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/uniget/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import (
"strings"

"github.com/spf13/cobra"
"github.com/spf13/viper"
//"github.com/uniget-org/cli/pkg/tool"
)

var baseImage string
var imageTarget string

func initGenerateCmd() {
rootCmd.AddCommand(generateCmd)

generateCmd.Flags().StringVar(&baseImage, "base", "ubuntu:24.04", "Base image to use")
generateCmd.Flags().StringVar(&baseImage, "base", "ubuntu:24.04", "Base image to use")
generateCmd.Flags().StringVar(&imageTarget, "root", "usr/local", "Root directory to install tools")
}

var generateCmd = &cobra.Command{
Expand Down Expand Up @@ -50,15 +51,15 @@ var generateCmd = &cobra.Command{
return fmt.Errorf("unable to find dependency called %s for %s", depName, toolName)
}
checkClientVersionRequirement(dep)
result = append(result, fmt.Sprintf("COPY --link --from=%s%s:latest / /%s", registryImagePrefix, dep.Name, viper.GetString("target")))
result = append(result, fmt.Sprintf("COPY --link --from=%s%s:latest / /%s", registryImagePrefix, dep.Name, imageTarget))
}

if len(toolVersion) == 0 {
toolVersion = tool.Version
} else if toolVersion != "latest" {
result = append(result, fmt.Sprintf("# Warning: Unable to check if %s has version %s", toolName, toolVersion))
}
result = append(result, fmt.Sprintf("COPY --link --from=%s%s:%s / /%s", registryImagePrefix, tool.Name, strings.Replace(toolVersion, "+", "-", -1), viper.GetString("target")))
result = append(result, fmt.Sprintf("COPY --link --from=%s%s:%s / /%s", registryImagePrefix, tool.Name, strings.Replace(toolVersion, "+", "-", -1), imageTarget))
}

fmt.Printf("%s", strings.Join(result, "\n"))
Expand Down

0 comments on commit beac7f2

Please sign in to comment.