build

package
v0.18.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command *cli.Command = &cli.Command{
	Name:    commandName,
	Aliases: []string{"b"},
	Usage:   "Build a Docker image from a project file.",
	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.",
			false,
		),
		shared.SeverityFlag("scan-severity"),
		shared.FormatsFlag("scan-formats"),
		shared.DisableErrorFlag("scan-disable-error"),
		&cli.StringFlag{
			Name:    "build-context",
			Aliases: []string{"c"},
			Usage:   "The directory to use as the build context for Docker, 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.",
			EnvVars: []string{"3LV_BUILD_CONTEXT"},
		},
		&cli.StringFlag{
			Name:    "registry",
			Aliases: []string{"r"},
			Usage:   "The container registry to use. Image name will be prefixed with this value.",
			EnvVars: []string{"3LV_REGISTRY"},
		},
		&cli.StringFlag{
			Name:    "go-main-package-directory",
			Usage:   "The main package directory to use when building a Go application.",
			EnvVars: []string{"3LV_GO_MAIN_PACKAGE_DIRECTORY"},
		},
		&cli.StringFlag{
			Name:    "cache-tag",
			Usage:   "The tag to use for the cache image.",
			Value:   "latest-cache",
			EnvVars: []string{"3LV_CACHE_TAG"},
		},
		&cli.StringFlag{
			Name:    "azure-tenant-id",
			Usage:   "The tenant ID to use when authenticating with the Azure Container Registry.",
			Hidden:  true,
			EnvVars: []string{"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,
			EnvVars: []string{"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,
			EnvVars: []string{"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,
			EnvVars: []string{"3LV_AZURE_FEDERATED_TOKEN"},
		},
		&cli.StringSliceFlag{
			Name:    "additional-tags",
			Aliases: []string{"t"},
			Usage:   "Additional tags to use when pushing the image to the registry.",
			EnvVars: []string{"3LV_ADDITIONAL_TAGS"},
		},
		&cli.StringSliceFlag{
			Name:    "include-files",
			Aliases: []string{"i"},
			Usage:   "A list of files to include in the Docker image. Currently only supported for Go applications.",
			EnvVars: []string{"3LV_INCLUDE_FILES"},
		},
		&cli.StringSliceFlag{
			Name:    "include-directories",
			Aliases: []string{"I"},
			Usage:   "A list of directories to include in the Docker image. Currently only supported for Go applications.",
			EnvVars: []string{"3LV_INCLUDE_DIRECTORIES"},
		},
		&cli.BoolFlag{
			Name:    "push",
			Aliases: []string{"p"},
			Usage:   "Push the image to the registry.",
			Value:   false,
			EnvVars: []string{"3LV_PUSH"},
		},
		&cli.BoolFlag{
			Name:    "generate-only",
			Aliases: []string{"G"},
			Usage:   "Generates a Dockerfile, but does not build the image.",
			Value:   false,
			EnvVars: []string{"3LV_GENERATE_ONLY"},
		},
		&cli.BoolFlag{
			Name:    "skip-authentication",
			Usage:   "Skip authentication before pushing the image to the registry.",
			Value:   false,
			EnvVars: []string{"3LV_SKIP_AUTHENTICATION"},
		},
	},
	Action: Build,
}

Functions

func Build

func Build(c *cli.Context) error

Types

type CSharpProjectFile

type CSharpProjectFile struct {
	XMLName       xml.Name `xml:"Project"`
	SDK           string   `xml:"Sdk,attr"`
	PropertyGroup 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 {
	ModuleDirectory      string // required
	BuildContext         string // required
	MainPackageDirectory string // required
	IncludeFiles         []string
	IncludeDirectories   []string
}

type GenerateDockerfileOptions

type GenerateDockerfileOptions struct {
	GoMainPackageDirectory string
	BuildContext           string
	IncludeFiles           []string
	IncludeDirectories     []string
}

type PropertyGroup

type PropertyGroup struct {
	AssemblyName    string
	TargetFramework string
}

Jump to

Keyboard shortcuts

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