Documentation
¶
Overview ¶
Package generate provides functions to generate a Lockfile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseImage ¶
type BaseImage struct {
Image *Image
// contains filtered or unexported fields
}
BaseImage represents an image in a Dockerfile's FROM instruction or a docker-compose file's image key.
type ComposefileFlags ¶
type ComposefileFlags struct {
*SpecificFlags
}
ComposefileFlags are flags that determine how docker-compose files are processed.
type ComposefileImage ¶
type ComposefileImage struct {
*Image
ServiceName string `json:"serviceName"`
DockerfilePath string `json:"dockerfile"`
// contains filtered or unexported fields
}
ComposefileImage contains an Image along with metadata used to generate a Lockfile.
type DockerfileFlags ¶
type DockerfileFlags struct {
*SpecificFlags
UseEnvAsBuildArgs bool
}
DockerfileFlags are flags that determine how Dockerfiles are processed.
type DockerfileImage ¶
type DockerfileImage struct {
*Image
// contains filtered or unexported fields
}
DockerfileImage contains an Image along with metadata used to generate a Lockfile.
type Flags ¶
type Flags struct {
DockerfileFlags *DockerfileFlags
ComposefileFlags *ComposefileFlags
}
Flags consist of SharedFlags, DockerfileFlags, and ComposefileFlags.
type Generator ¶
type Generator struct {
DockerfilePaths []string
ComposefilePaths []string
DockerfileEnvBuildArgs bool
LockfileName string
}
Generator generates Lockfiles. DockerfileEnvBuildArgs determines whether environment variables should be used as build args in Dockerfiles.
func NewGenerator ¶
NewGenerator creates a Generator from command line flags. If no Dockerfiles or docker-compose files are specified as flags, files that match "Dockerfile", "docker-compose.yml", and "docker-compose.yaml" will be used. If files are specified in command line flags, only those files will be used.
func (*Generator) GenerateLockfile ¶
GenerateLockfile creates a Lockfile and writes its bytes to an io.Writer.
type Image ¶
type Image struct {
Name string `json:"name"`
Tag string `json:"tag"`
Digest string `json:"digest"`
}
Image contains information extracted from 'FROM' instructions in Dockerfiles or 'image:' keys in docker-compose files. For instance, FROM busybox:latest@sha256:dd97a3f... could be represented as: Image{Name: busybox, Tag: latest, Digest: dd97a3f...}.
type Lockfile ¶
type Lockfile struct {
DockerfileImages map[string][]*DockerfileImage `json:"dockerfiles"`
ComposefileImages map[string][]*ComposefileImage `json:"composefiles"`
}
Lockfile contains DockerfileImages and ComposefileImages identified by their filepaths.
func NewLockfile ¶
func NewLockfile( dIms map[string][]*DockerfileImage, cIms map[string][]*ComposefileImage, ) *Lockfile
NewLockfile creates a Lockfile, first sorting DockerfileImages and ComposefileImages.
type SharedFlags ¶
type SharedFlags struct {
}
SharedFlags are flags that do not differ between Dockerfiles and docker-compose files.
func NewSharedFlags ¶
func NewSharedFlags( bDir string, lName string, configFile string, envFile string, verbose bool, ) (*SharedFlags, error)
NewSharedFlags preprocesses and validates the fields of SharedFlags.
type SpecificFlags ¶
SpecificFlags are flags whose values differ between Dockerfiles and docker-compose files.
func NewSpecificFlags ¶
func NewSpecificFlags( bDir string, paths []string, globs []string, recursive bool, ) (*SpecificFlags, error)
NewSpecificFlags preprocesses and validates the fields of SpecificFlags.