build

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPythonVersion = "3.13"

Variables

View Source
var Command *cli.Command = &cli.Command{
	Name:      commandName,
	Aliases:   []string{"b"},
	Usage:     "Build a Docker image from a project file.",
	UsageText: "3lv build [options] <application-name>",
	Flags: []cli.Flag{
		shared.ProjectFileFlag(),
		shared.SystemNameFlag(
			"The system name to prefix the image name with." +
				" If not provided, we will try to use the current git repository name.",
		),
		shared.SeverityFlag("scan-severity"),
		shared.FormatsFlag("scan-formats"),
		shared.DisableErrorFlag("scan-disable-error"),
		shared.RegistryFlag("The container registry to use. Image name will be prefixed with this value."),
		&cli.StringFlag{
			Name:    "build-context",
			Aliases: []string{"c"},
			Usage: "The directory to use as the Docker build context, i.e. what files Docker will know about when building." +
				" We default to the directory of the project file. This means that if you need files outside of the directory of" +
				" the project file, you need to specify this flag.",
			Sources: cli.EnvVars("3LV_BUILD_CONTEXT"),
		},
		&cli.StringFlag{
			Name:    "go-main-package-directory",
			Usage:   "The main package directory to use when building a Go application.",
			Sources: cli.EnvVars("3LV_GO_MAIN_PACKAGE_DIRECTORY"),
		},
		&cli.StringFlag{
			Name:    "cache-tag",
			Usage:   "The tag to use for the cache image.",
			Value:   "latest-cache",
			Sources: cli.EnvVars("3LV_CACHE_TAG"),
		},
		&cli.StringFlag{
			Name:    "azure-tenant-id",
			Usage:   "The tenant ID to use when authenticating with the Azure Container Registry.",
			Hidden:  true,
			Sources: cli.EnvVars("3LV_AZURE_TENANT_ID"),
		},
		&cli.StringFlag{
			Name:    "azure-subscription-id",
			Usage:   "The subscription ID to use when authenticating with the Azure Container Registry.",
			Hidden:  true,
			Sources: cli.EnvVars("3LV_AZURE_SUBSCRIPTION_ID"),
		},
		&cli.StringFlag{
			Name: "azure-client-id",
			Usage: "The client ID to use when authenticating with the Azure Container registry." +
				" Must be combined with --azure-federated-token.",
			Hidden:  true,
			Sources: cli.EnvVars("3LV_AZURE_CLIENT_ID"),
		},
		&cli.StringFlag{
			Name: "azure-federated-token",
			Usage: "The federated token to use when authenticating with the Azure Container Registry." +
				" Must be combined with --client-id.",
			Hidden:  true,
			Sources: cli.EnvVars("3LV_AZURE_FEDERATED_TOKEN"),
		},
		&cli.StringSliceFlag{
			Name:    "additional-tags",
			Aliases: []string{"t"},
			Usage:   "Additional tags to use when pushing the image to the registry.",
			Sources: cli.EnvVars("3LV_ADDITIONAL_TAGS"),
		},
		&cli.BoolFlag{
			Name:    "push",
			Aliases: []string{"p"},
			Usage:   "Push the image to the registry.",
			Value:   false,
			Sources: cli.EnvVars("3LV_PUSH"),
		},
		&cli.BoolFlag{
			Name:    "generate-only",
			Aliases: []string{"G"},
			Usage:   "Generates a Dockerfile, but does not build the image.",
			Value:   false,
			Sources: cli.EnvVars("3LV_GENERATE_ONLY"),
		},
		&cli.BoolFlag{
			Name:    "skip-authentication",
			Usage:   "Skip authentication before pushing the image to the registry.",
			Value:   false,
			Sources: cli.EnvVars("3LV_SKIP_AUTHENTICATION"),
		},
	},
	Action: Build,
}

Functions

func Build

func Build(_ context.Context, c *cli.Command) error

func GetImageName added in v0.19.0

func GetImageName(
	registry string,
	systemName string,
	applicationName string,
) (string, error)

Types

type CSharpProjectFile

type CSharpProjectFile struct {
	XMLName       xml.Name      `xml:"Project"`
	SDK           string        `xml:"Sdk,attr"`
	PropertyGroup PropertyGroup `xml:"PropertyGroup"`
}

type DockerfileVariablesDotnet

type DockerfileVariablesDotnet struct {
	CsprojFile       string // required
	AssemblyName     string // required
	BaseImageTag     string // required
	RuntimeBaseImage string // required
}

type DockerfileVariablesGo added in v0.4.1

type DockerfileVariablesGo struct {
	GoModuleDirectory    string // required
	MainPackageDirectory string // required
}

type DockerfileVariablesPython added in v0.24.0

type DockerfileVariablesPython struct {
	PythonVersion string
}

type GenerateDockerfileOptions

type GenerateDockerfileOptions struct {
	GoMainPackageDirectory string
	BuildContext           string
}

type PropertyGroup

type PropertyGroup struct {
	AssemblyName    string `xml:"AssemblyName"`
	TargetFramework string `xml:"TargetFramework"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL