goreleaser

package
v0.53.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDockerRegistry  = "docker.io/persesdev"
	DefaultDebugDockerfile = "distroless-debug.Dockerfile"
	DefaultDebugSuffix     = "-debug"
	DefaultMainBranch      = "main"
)

Variables

View Source
var (
	DefaultPlatform = []string{"linux/amd64", "linux/arm64"}
	DefaultTags     = []string{
		"latest",
		"{{ .Tag }}",
		"v{{ .Major }}.{{ .Minor }}",
		"{{ .Tag }}-distroless",
		"v{{ .Major }}.{{ .Minor }}-distroless",
	}
)

Functions

func BuildManifestsAndPushIt

func BuildManifestsAndPushIt(dockerConfig *DockerConfig)

BuildManifestsAndPushIt is going to build the manifests and push them to the docker registry. It will also push the images for each platform assuming they are already built and tagged locally.

func Generate

func Generate(baseConfig []byte, dockerConfig *DockerConfig)

Types

type DockerConfig

type DockerConfig struct {
	// The name of the docker image to generate. For example: "perses".
	// This is a required field.
	ImageName string
	// The list of binaries to include in the docker image.
	// The binary must be built by Goreleaser and the IDs must match the ones defined in the build section of the Goreleaser config.
	BinaryIDs []string
	// If true, we add a debug image with "debug-" prefix containing additional debugging tools (curl, bash, etc)
	DebugImage bool
	// The path to the Dockerfile to use for the debug image.
	// If empty, a default Dockerfile is used: "distroless-debug.Dockerfile"
	DebugDockerfile string
	// By default, we push to Docker Hub, so if empty the registry is docker.io/persesdev
	Registry []string
	// The list of platforms to build the docker image for.
	// If empty, the default platforms targeted are "linux/amd64" and "linux/arm64".
	Platform []string
	// List of extra files to include in the docker image.
	// Leave it empty if no extra files are needed.
	ExtraFiles []string

	// The current git branch
	// This is an internal field populated automatically, but can be overridden for testing.
	Branch string
	// The current git commit
	// This is an internal field populated automatically, but can be overridden for testing.
	Commit string
	// The current date string
	// This is an internal field populated automatically, but can be overridden for testing.
	Date string
}

DockerConfig represents the configuration needed to generate the Goreleaser docker config.

func (*DockerConfig) Build

func (c *DockerConfig) Build() []config.DockerV2

func (*DockerConfig) BuildDockerImagesAndManifests

func (c *DockerConfig) BuildDockerImagesAndManifests() ([]DockerManifest, []string)

BuildDockerImagesAndManifests builds the list of docker images and Manifests to be pushed for the main branch. This function should not be used for other branches as we are not pushing images for other branches. The exceptiong is during the release process where goreleaser will handle everything automatically (tags, manifests, etc).

type DockerManifest

type DockerManifest struct {
	// The name of the manifest associated to the docker images. For example: "docker.io/persesdev/perses:latest"
	Name string
	// The list of images associated to the manifest. Each image corresponds to a platform.
	// For example: "docker.io/persesdev/perses:latest-amd64"
	Images []string
}

Jump to

Keyboard shortcuts

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