docker
docker
Prepare Docker build variables to match the legacy bash script.
Functions
| Name | Description |
|---|---|
| base_image_name | Get base image names from a Dockerfile. |
| prepare_docker_build_variables | Prepare Docker build variables and optionally write them to GITHUB_ENV. |
| tag_from_dockerfile | Extract the tag from the Dockerfile name (last extension). |
base_image_name
docker.base_image_name(dockerfile)Get base image names from a Dockerfile.
Matches the bash behavior: only lines starting with “FROM” are used and the literal “FROM” substring is removed everywhere on that line.
prepare_docker_build_variables
docker.prepare_docker_build_variables(
dockerfile,
suffix,
dockerhub_account,
github_env=None,
now=None,
)Prepare Docker build variables and optionally write them to GITHUB_ENV.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| dockerfile | str | Path to the Dockerfile. | required |
| suffix | str | Suffix for the image tag (e.g., “dev”, “main”). | required |
| dockerhub_account | str | Docker Hub account/namespace. | required |
| github_env | str | Path to the GitHub Actions env file. | None |
| now | datetime | Override current time for deterministic output. | None |
Returns
| Name | Type | Description |
|---|---|---|
| dict | Dict[str, str] | Mapping of variable names to their values. |
tag_from_dockerfile
docker.tag_from_dockerfile(dockerfile)Extract the tag from the Dockerfile name (last extension).
Mirrors bash ${bn_dockerfile##*.} behavior.