Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingWorkdirVolume = errors.New("missing Docker volume or bind mount for work directory")
Functions ¶
Types ¶
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps a Docker client instance and provides methods to pull images and start containers.
func NewDockerClient ¶
func NewDockerClient(log *zap.Logger, baseDir string) (h *DockerClient, err error)
NewDockerClient creates a new DockerClient. To configure the client, use environment variables: DOCKER_HOST, DOCKER_API_VERSION, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are supported.
When running in a Docker-in-Docker environment, baseDir is used to determine the volume path on the Docker host, in order to mount job directories correctly.
func (*DockerClient) Executor ¶
func (dc *DockerClient) Executor(doc Document) Exec
func (*DockerClient) Run ¶
Run creates a new Docker container from the given image tag, mounts the working directory into it, and executes the given command in it.
func (*DockerClient) SetImages ¶
func (dc *DockerClient) SetImages(ctx context.Context, alwaysPull bool, tags ...string) ([]string, error)
SetImages ensures that the given image tags are present on the Docker host (missing images are pulled automatically). Existing images are not updated, unless alwaysPull is true.
If stdout is a terminal, download progress is reported.
SetImages also sets the DockerClients allow list from which containers are started.
type Document ¶ added in v0.2.0
type Document interface { WorkingDirectory() (string, error) MainInput() (string, error) Engine() tex.Engine Image() string }
Document is a sub-set of the tex.Document interface.
type MockExec ¶ added in v0.2.0
type MockExec struct { // ShouldFail controls whether Run will return an error or not. ShouldFail bool // Result holds content written to either the document's result PDF // file, or its correspondint error log file, depending on the // value of ShouldFail. ResultContents string // contains filtered or unexported fields }