docker

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerRepoLabel     = "com.opentable.sous.repo_url"
	DockerPathLabel     = "com.opentable.sous.repo_offset"
	DockerVersionLabel  = "com.opentable.sous.version"
	DockerRevisionLabel = "com.opentable.sous.revision"
)
View Source
const InMemory = "file:dummy.db?mode=memory&cache=shared"

InMemory configures SQLite to use an in-memory database The dummy file allows multiple goroutines see the same in-memory DB

Variables

View Source
var (
	// Log is an alias to sous.Log
	Log = sous.Log
)

Functions

func GetDatabase

func GetDatabase(cfg *DBConfig) (*sql.DB, error)

GetDatabase initialises a new database for a NameCache.

func InMemoryConnection

func InMemoryConnection(base string) string

InMemoryConnection builds a connection string based on a base name This is mostly useful for testing, so that we can have separate cache DBs per test

func Labels

func Labels(sid sous.SourceID) map[string]string

Labels computes a map of labels that should be applied to a container image that is built based on this SourceID.

func NewBuildArtifact

func NewBuildArtifact(imageName string, qstrs strpairs) *sous.BuildArtifact

NewBuildArtifact creates a new sous.BuildArtifact representing a Docker image.

func SourceIDFromLabels

func SourceIDFromLabels(labels map[string]string) (sous.SourceID, error)

SourceIDFromLabels builds a SourceID from a map of labels, generally acquired from a Docker image.

Types

type Args

type Args interface {
	String() string
}

type ArrayArg

type ArrayArg []string

type ArrayArgs

type ArrayArgs []string

func (ArrayArgs) String

func (a ArrayArgs) String() string

type BuildTarget

type BuildTarget interface {
	BuildImage()
	BuildContainer()
}

BuildTarget represents a single target within a Build.

type Builder

type Builder struct {
	ImageMapper               *NameCache
	DockerRegistryHost        string
	SourceShell, ScratchShell shell.Shell
	Pack                      sous.Buildpack
}

Builder represents a single build of a project.

func NewBuilder

func NewBuilder(nc *NameCache, drh string, sourceShell, scratchShell shell.Shell) (*Builder, error)

NewBuilder creates a new build using source code in the working directory of sourceShell, and using the working dir of scratchShell as temporary storage.

func (*Builder) ApplyMetadata

func (b *Builder) ApplyMetadata(br *sous.BuildResult, bc *sous.BuildContext) error

ApplyMetadata applies container metadata etc. to a container

func (*Builder) Register

func (b *Builder) Register(br *sous.BuildResult, bc *sous.BuildContext) error

Register registers the build artifact to the the registry

func (*Builder) RevisionTag

func (b *Builder) RevisionTag(v sous.SourceID) string

RevisionTag computes an image tag from a SourceVersion's revision id

func (*Builder) VersionTag

func (b *Builder) VersionTag(v sous.SourceID) string

VersionTag computes an image tag from a SourceVersion's version

type Config

type Config struct {
	RegistryHost string `env:"SOUS_DOCKER_REGISTRY_HOST"`
	// DatabaseDriver is the name of the driver to use for local
	// persistence.
	DatabaseDriver string `env:"SOUS_DOCKER_DB_DRIVER"`
	// DatabaseConnection is the database connection string for local
	// persistence.
	DatabaseConnection string `env:"SOUS_DOCKER_DB_CONN"`
}

func DefaultConfig

func DefaultConfig() Config

DefaultConfig builds a default configuration, which can be then overridden by client code.

func (Config) DBConfig

func (c Config) DBConfig() DBConfig

type DBConfig

type DBConfig struct {
	Driver, Connection string
}

DBConfig is a database configuration for a NameCache.

type DockerfileBuildpack

type DockerfileBuildpack struct {
}

DockerfileBuildpack is a simple buildpack for building projects using their own Dockerfile.

func NewDockerfileBuildpack

func NewDockerfileBuildpack() *DockerfileBuildpack

NewDockerfileBuildpack creates a Dockerfile buildpack

func (*DockerfileBuildpack) Build

func (d *DockerfileBuildpack) Build(c *sous.BuildContext) (*sous.BuildResult, error)

Build implements Buildpack.Build

func (*DockerfileBuildpack) Detect

func (d *DockerfileBuildpack) Detect(c *sous.BuildContext) (*sous.DetectResult, error)

type File

type File struct {
	From, Maintainer string
	Instructions     Instructions
}

func (*File) ADD

func (f *File) ADD(target string, files ...string)

func (*File) CMD

func (f *File) CMD(args ...string)

func (*File) COPY

func (f *File) COPY(target string, files ...string)

func (*File) ENTRYPOINT

func (f *File) ENTRYPOINT(args ...string)

func (*File) ENV

func (f *File) ENV(m map[string]string)

func (*File) LABEL

func (f *File) LABEL(m map[string]string)

func (*File) RUN

func (f *File) RUN(args ...string)

func (File) String

func (f File) String() string

func (*File) USER

func (f *File) USER(username string)

func (*File) WORKDIR

func (f *File) WORKDIR(path string)

type Instruction

type Instruction struct {
	Name string
	Args Args
}

func (Instruction) String

func (i Instruction) String() string

type Instructions

type Instructions []Instruction

func (*Instructions) Add

func (is *Instructions) Add(name string, args Args)

func (Instructions) String

func (is Instructions) String() string

type KeyValueArgs

type KeyValueArgs map[string]string

func (KeyValueArgs) Flatten

func (kv KeyValueArgs) Flatten() []string

func (KeyValueArgs) String

func (kv KeyValueArgs) String() string

type NameCache

type NameCache struct {
	RegistryClient docker_registry.Client
	DB             *sql.DB
}

NameCache is a database for looking up SourceIDs based on Docker image names and vice versa.

func NewNameCache

func NewNameCache(cl docker_registry.Client, db *sql.DB) *NameCache

NewNameCache builds a new name cache

func (*NameCache) GetArtifact

func (nc *NameCache) GetArtifact(sid sous.SourceID) (*sous.BuildArtifact, error)

GetArtifact implements sous.Registry.GetArtifact

func (*NameCache) GetCanonicalName

func (nc *NameCache) GetCanonicalName(in string) (string, error)

GetCanonicalName returns the canonical name for an image given any known name

func (*NameCache) GetSourceID

func (nc *NameCache) GetSourceID(a *sous.BuildArtifact) (sous.SourceID, error)

GetSourceID looks up the source ID for a given image name

func (*NameCache) GroomDatabase added in v0.0.2

func (nc *NameCache) GroomDatabase() error

GroomDatabase ensures that the database to back the cache is the correct schema

func (*NameCache) ListSourceIDs

func (nc *NameCache) ListSourceIDs() ([]sous.SourceID, error)

ListSourceIDs implements Registry

func (*NameCache) Warmup

func (nc *NameCache) Warmup(r string) error

Warmup implements Registry

type NoImageNameFound

type NoImageNameFound struct {
	sous.SourceID
}

NoImageNameFound is returned when we cannot find an image name for a given SourceID.

func (NoImageNameFound) Error

func (e NoImageNameFound) Error() string

type NoSourceIDFound

type NoSourceIDFound struct {
	// contains filtered or unexported fields
}

NoSourceIDFound is returned when we cannot find a SourceID for a given image name

func (NoSourceIDFound) Error

func (e NoSourceIDFound) Error() string

type NotModifiedErr

type NotModifiedErr struct{}

NotModifiedErr is returned when an HTTP server returns Not Modified in response to a conditional request

func (NotModifiedErr) Error

func (e NotModifiedErr) Error() string

type SingleArg

type SingleArg string

func (SingleArg) String

func (s SingleArg) String() string

type SpaceSeparatedArgs

type SpaceSeparatedArgs []string

func (SpaceSeparatedArgs) String

func (s SpaceSeparatedArgs) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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