container

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package container for dealing with containers via dagger

Index

Constants

View Source
const (
	// ModeURL means that opts.ContainerURL is actual URL
	ModeURL containerURLtype = iota
	// ModeDockerfile means that opts.ContainerURL is filepath to Dockerfile
	ModeDockerfile
	// ModeTarfile means that opts.ContainerURL is filepath to TAR file
	ModeTarfile
)

Variables

This section is empty.

Functions

func CheckIfDiscontinued

func CheckIfDiscontinued(containerURL string) error

CheckIfDiscontinued prints a warning if the used container is discontinued

func CleanupAfterContainer

func CleanupAfterContainer(ctx context.Context) error

CleanupAfterContainer performs cleanup operations after container use

func GetArtifacts

func GetArtifacts(ctx context.Context, container *dagger.Container, artifacts *[]Artifacts) error

GetArtifacts extracts files from container to host Either both ContainerDir and HostDir must be directories, or both must be files

func Setup

func Setup(ctx context.Context, client *dagger.Client, opts *SetupOpts) (*dagger.Container, error)

Setup for setting up a Docker container via dagger

Types

type Artifacts

type Artifacts struct {
	ContainerPath string // Path inside container
	ContainerDir  bool   // Is ^^^ path directory?
	HostPath      string // Path inside host
	HostDir       bool   // Is ^^^ path directory?
}

Artifacts is passes to GetArtifacts as argument, and specifies extraction of files form container at containerDir to host at hostDir

type SetupOpts

type SetupOpts struct {
	ContainerURL      string   // URL or name of docker container
	MountHostDir      string   // Directory from host to mount into container
	MountContainerDir string   // Where to mount ^^^ host directory inside container
	WorkdirContainer  string   // Workdir of the container
	ContainerInputDir string   // Directory for input files
	InputDirs         []string // List of directories to copy into container
	InputFiles        []string // List of files to copy into container
}

SetupOpts congregates options for Setup function None of the values can be empty string, and mountContainerDir cannot be '.' or '/'

func (SetupOpts) Validate

func (opts SetupOpts) Validate() error

Validate the data in struct

Jump to

Keyboard shortcuts

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