docker

package
v3.6.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package docker wraps the Docker engine SDK and the AWS ECR SDK to build the Gothic Lambda image and push it to Elastic Container Registry. It replaces the `sam build` + ECR push previously performed by the SAM CLI.

Provider Dockerfiles are embedded in the CLI binary (never seeded to a user's project on disk). They are selected at build time by the deployment provider (e.g. "aws", "gcp"). A user may override the embedded Dockerfile by setting DockerfilePath in gothic.config.go.

Index

Constants

This section is empty.

Variables

View Source
var DockerfileFS embed.FS

DockerfileFS holds the provider-specific Dockerfiles compiled into the binary.

Functions

This section is empty.

Types

type DockerEngine

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

DockerEngine builds the Gothic Lambda image and pushes it to ECR.

func NewDockerEngine

func NewDockerEngine() (*DockerEngine, error)

NewDockerEngine constructs a DockerEngine connected to the local Docker daemon via environment configuration, negotiating the API version with the daemon.

func (*DockerEngine) BuildImage

func (e *DockerEngine) BuildImage(ctx context.Context, projectRoot, dockerfilePath, imageName, tag, provider string) error

BuildImage builds the container image for the given provider. dockerfilePath, when non-empty, overrides the embedded provider Dockerfile. The image is tagged as imageName:tag.

func (*DockerEngine) CheckDaemon

func (e *DockerEngine) CheckDaemon(ctx context.Context) error

CheckDaemon verifies the Docker daemon is reachable. The returned error always contains the substring "Docker daemon is not running" so callers and tests can assert on it.

func (*DockerEngine) Close

func (e *DockerEngine) Close() error

Close releases the underlying Docker client resources.

func (*DockerEngine) EnsureECRRepo

func (e *DockerEngine) EnsureECRRepo(ctx context.Context, awsCfg aws.Config, repoName string) (string, error)

EnsureECRRepo returns the URI of the ECR repository named repoName, creating it if it does not already exist.

func (*DockerEngine) PushImage

func (e *DockerEngine) PushImage(ctx context.Context, awsCfg aws.Config, imageURI string) error

PushImage authenticates against ECR and pushes the exact image reference given (repo:<immutable-tag>). Mid-stream push failures (which the Docker SDK reports inside the JSON stream rather than as a Go error) are surfaced as errors.

The reference MUST be immutable (a unique per-deploy tag), never repo:latest: an image-based Lambda pins to the digest resolved at apply time and does not re-pull a moving tag, and a constant image_uri string makes tofu see no diff on redeploy — so the Lambda would keep running the previous image forever.

Jump to

Keyboard shortcuts

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