The job type docker is one of the most important jobs. You can use it to run any Docker container you like.
{
"version": 1,
"jobs": [{
"type": "docker",
"name": "build",
"docker_file": "infrabox/build-and-test/Dockerfile",
"command": ["echo", "hello world"],
"resources": { "limits": { "cpu": 1, "memory": 1024 } },
"build_only": false,
"enable_docker_build_kit": true,
"build_context": "...",
"cache": { ... },
"timeout": 3600,
"depends_on": ["other_job_name"],
"environment": { ... },
"build_arguments": { ... },
"deployments": [ ... ],
"security_context": { ... },
"repository": { ... },
"registries": [],
"target": "specificstage"
}]
}
Name | Required | Type | Default | Description |
---|---|---|---|---|
type | true | string | Has to be "docker" to run a single Docker container | |
name | true | string | Name of the job | |
docker_file | true | string | Path to the Dockerfile |
|
command | false | string | The command in exec form to be used when the container is run. Ignored if build_only=true |
|
resources | true | Resource Configuration | Specify the required resources for your job. | |
build_only | true | boolean | true | If set to true the container will only be build but not run. Use it if you only want to build a container and push it to a registry. See here for how to push to a docker registry. |
enable_docker_build_kit | false | boolean | false | If set to true, InfraBox will try to use the Dokcer Buildkit to build the containers. For more details, please refer to Docker docs |
build_context | false | string | Specify the docker build context. If not set the directory containing the infrabox.json file will be used. |
|
cache | false | Cache Configuration | {} | Configure the caching behavior |
timeout | false | integer | 3600 | Timeout in seconds after which the job should be killed. Timeout starts when the job is set to running |
depends_on | false | Dependency Configuration | [] | Jobs may have dependencies. You can list all jobs which should finish before the current job may be executed. |
environment | false | Environment Variables | {} | Can be used to set environment variables for the job. |
build_arguments | false | Build Arguments | {} | Can be used to set docker build arguments. |
deployments | false | Deployment Configuration | [] | Push your images to a registry. |
security_context | false | Security Context | [] | Configure security related options, |
repository | false | Repository Configuration | {} | Configure git repository options. |
registries | false | Source Registry Configuration | [] | Configure the source registries. |
target | false | string | Stop at a specific build stage when using a multi-stage Dockerfile. Reference. |
To set docker build arguments create an object with the names and values for build_arguments
.
{
"version": 1,
"jobs": [{
"type": "docker",
...
"build_arguments": {
"ARG_1": "My value",
"ANOTHER_ARG": "some other value"
}
}]
}
Build arguments are only supported for docker
job types.
{
"version": 1,
"jobs": [{
...
"security_context": {
"privileged": false
}
}]
}
Name | Required | Type | Default | Description |
---|---|---|---|---|
privileged | false | boolean | false | If set to true the container will be run in privileged mode |