Dofigen struct reference

December 17, 2025 ยท View on GitHub

This is the reference for the Dofigen configuration file structure.

The Dofigen struct is a YAML or JSON object that can be used to generate a Dockerfile.

The struct is permissive in order to make it easy to write and read. For example, some objects can be parsed from string and all arrays can be parsed from single element.

Dofigen

This is the root object of the Dofigen configuration file.

It extends the Extend and Stage structures.

FieldTypeDescription
contextstring[]The context of the Docker build. This is used to generate a .dockerignore file.
ignorestring[]The elements to ignore from the build context. This is used to generate a .dockerignore file.
globalArgmap<string, string>The build args that can be used in the global scope. See Dockerfile reference and variable scoping.
buildersmap<string, Stage>The builder stages of the Dockerfile.
entrypointstring[]The entrypoint of the Dockerfile. See Dockerfile reference.
cmdstring[]The default command of the Dockerfile. See Dockerfile reference.
volumestring[]Create volume mounts. See Dockerfile reference.
exposePort[]The ports exposed by the Dockerfile. See Dockerfile reference.
healthcheckHealthcheckThe healthcheck of the Dockerfile. See Dockerfile reference.

Extend

This let you extend a struct from local or remote files.

FieldTypeDescription
extendstring or string[]The files to extend.

Stage

This represents a Dockerfile stage.

It extends the Run structure.

FieldTypeDescription
from...FromContextThe base of the stage. See Dockerfile reference.
labelmap<string, string>Add metadata to an image. See Dockerfile reference
userUserThe user and group of the stage. See Dockerfile reference.
workdirstringThe working directory of the stage. See Dockerfile reference.
argmap<string, string>The build args that can be used in the stage. See Dockerfile reference.
envmap<string, string>The environment variables of the stage. See Dockerfile reference.
copyCopyResource or CopyResource[]The copy instructions of the stage. See Dockerfile reference and Dockerfile reference.
rootRunThe run instructions of the stage as root user.

FromContext

This represents a context origin.

Possible fields are:

User

This represents user and group definition.

It can be parsed from string.

FieldTypeDescription
userstringThe user name or ID.
groupstringThe group name or ID.

CopyResource

This represents the COPY/ADD instructions in a Dockerfile.

It can be one of the following objects:

  • Copy : A copy instruction.
  • CopyContent : A copy instruction from file content.
  • Add : An add instruction.
  • AddGitRepo : An add instruction from a git repository.

Run

This represents a run command.

FieldTypeDescription
runstring or string[]The commands to run.
shellstring or string[]The shell to use for the RUN command. See Dockerfile reference.
cacheCache[]The cache definitions during the run. See Dockerfile reference.
bindBind[]The file system bindings during the run. See Dockerfile reference.
tmpfsTmpFs[]This mount type allows mounting tmpfs in the build container.
secretSecret[]This allows the build container to access secret values, such as tokens or private keys, without baking them into the image.
sshSsh[]This allows the build container to access SSH keys via SSH agents, with support for passphrases.
networkdefault, none or hostThis allows control over which networking environment the command is run in.
securitysandbox or insecureThe default security mode is sandbox. With security: insecure, the builder runs the command without sandbox in insecure mode, which allows to run flows requiring elevated privileges (e.g. containerd).

Cache

This represents a cache definition during a run.

It can be parsed from string.

FieldTypeDescription
idstringThe id of the cache. This is used to share the cache between different stages.
targetstringThe target path of the cache.
readonlybooleanDefines if the cache is readonly.
sharing"shared" or "private" or "locked"The sharing strategy of the cache.
from...FromContextThe base of the cache mount.
sourcestringSubpath in the from to mount.
chmodstring or integerThe permissions of the cache.
chownUserThe user and group that own the cache.

Bind

This represents file system binding during a run.

It can be parsed from string.

FieldTypeDescription
targetstringThe target path of the bind.
from...FromContextThe base of the cache mount.
sourcestringSubpath in the from to mount.
readwritebooleanDefines if the bind is read and write.

TmpFs

This mount type allows mounting tmpfs in the build container.

It can be parsed from string.

FieldTypeDescription
targetstringMount path.
sizestringSpecify an upper limit on the size of the filesystem.

Secret

This mount type allows the build container to access secret values, such as tokens rivate keys, without baking them into the image. By default, the secret is mounted as a file. You can also mount the secret as an ronment variable by setting the env option. See https://docs.docker.com/reference/dockerfile/#run---mounttypesecret

FieldTypeDescription
idstringID of the secret. Defaults to basename of the target path.
targetstringMount the secret to the specified path. Defaults to /run/secrets/ + id if unset and if env is also unset.
envstringMount the secret to an environment variable instead of a file, or both.
requiredstringIf set to true, the instruction errors out when the secret is unavailable. Defaults to false.
modestringFile mode for secret file in octal. Default 0400.
uidintUser ID for secret file. Default 0.
gidintGroup ID for secret file. Default 0.

Ssh

This mount type allows the build container to access SSH keys via SSH agents, with support for passphrases. See https://docs.docker.com/reference/dockerfile/#run---mounttypessh

FieldTypeDescription
idstringID of SSH agent socket or key. Defaults to "default".
targetstringSSH agent socket path. Defaults to /run/buildkit/ssh_agent.${N}.
requiredIf set to true, the instruction errors out when the key is unavailable. Defaults to false.
modestringFile mode for socket in octal. Default 0600.
uidintUser ID for socket. Default 0.
gidintGroup ID for socket. Default 0.

Healthcheck

This represents the Dockerfile healthcheck instruction.

FieldTypeDescription
cmdstringThe test command to run.
intervalstringThe time between running the check (ms
timeoutstringThe time to wait before considering the check to have hung (ms
startPeriodstringThe time to wait for the container to start before starting health-retries countdown (ms
retriesintThe number of consecutive failures needed to consider a container as unhealthy.

ImageName

This represents a Docker image name.

It can be parsed from string.

FieldTypeDescription
hoststringThe host of the image registry.
portintThe port of the image registry.
pathstringThe path of the image repository.
platformstringThe optional platform option can be used to specify the platform of the image in case FROM references a multi-platform image. This option is ignored if not for a stage (build or runtime) fromImage.

The version of the image can also be set with one of the following fields:

  • tag : The tag of the image.
  • digest : The digest of the image.

Copy

This represents the COPY instruction in a Dockerfile.

It extends the CopyOptions structure.

Can be parsed from string.

FieldTypeDescription
from...FromContextThe origin of the copy. See https://docs.docker.com/reference/dockerfile/#copy---from
pathsstring[]The paths to copy.

CopyContent

This represents the COPY instruction in a Dockerfile based on file content.

It extends the CopyOptions structure, but the target field is required.

Can be parsed from string.

FieldTypeDescription
contentstringContent of the file to copy.
substitutebooleanIf true, replace variables in the content at build time. Default is true.

AddGitRepo

This represents the ADD instruction in a Dockerfile specific for Git repositories.

It extends the CopyOptions structure.

Can be parsed from string.

FieldTypeDescription
repostringThe URL of the Git repository.
keepGitDirbooleanKeep the git directory. See https://docs.docker.com/reference/dockerfile/#add---keep-git-dir
checksumstringThe checksum of the files.

Add

This represents the ADD instruction in a Dockerfile for files from URLs or to uncompress an archive.

It extends the CopyOptions structure.

Can be parsed from string.

FieldTypeDescription
filesstring[]The source files to add.
checksumstringThe checksum of the files. See https://docs.docker.com/reference/dockerfile/#add---checksum
unpackbooleanThe unpack flag controls whether or not to automatically unpack tar archives (including compressed formats like gzip or bzip2) when adding them to the image.

CopyOptions

This represents the options of a COPY/ADD instructions.

FieldTypeDescription
targetstringThe target path of the copied files.
chownUserThe user and group that own the copied files. See https://docs.docker.com/reference/dockerfile/#copy---chown---chmod
chmodstring or integerThe permissions of the copied files. See https://docs.docker.com/reference/dockerfile/#copy---chown---chmod
linkbooleanUse of the link flag. See https://docs.docker.com/reference/dockerfile/#copy---link

Port

This represents a port definition.

It can be parsed from string.

FieldTypeDescription
portintThe port number.
protocol"tcp" or "udp"The protocol of the port.