Skip to main content

BASE_STEP_NAME

Depths explained:
  1. TemplateClass
  2. Caller method (eg. copy(), fromImage(), etc.)

BuildException

class BuildException(Exception)
Raised when a build fails.

FileUploadException

class FileUploadException(BuildException)
Raised when a file upload fails.

strip_ansi_escape_codes

def strip_ansi_escape_codes(text: str) -> str
Strip ANSI escape codes from a string. Source: https://github.com/chalk/ansi-regex/blob/main/index.js

get_caller_frame

def get_caller_frame(depth: int) -> Optional[FrameType]
Get the caller frame. Skip this function (first frame).

get_caller_directory

def get_caller_directory(depth: int) -> Optional[str]
Get the directory of the file that called this function.

DockerfFileFinalParserInterface

class DockerfFileFinalParserInterface(Protocol)
Protocol defining the final interface for Dockerfile parsing callbacks.

DockerfileParserInterface

class DockerfileParserInterface(Protocol)
Protocol defining the interface for Dockerfile parsing callbacks.

run_cmd

def run_cmd(command: Union[str, List[str]],
            user: Optional[str] = None) -> "DockerfileParserInterface"
Handle RUN instruction.

copy

def copy(src: Union[str, List[CopyItem]],
         dest: Optional[str] = None,
         force_upload: Optional[bool] = None,
         user: Optional[str] = None,
         mode: Optional[int] = None) -> "DockerfileParserInterface"
Handle COPY instruction.

set_workdir

def set_workdir(workdir: str) -> "DockerfileParserInterface"
Handle WORKDIR instruction.

set_user

def set_user(user: str) -> "DockerfileParserInterface"
Handle USER instruction.

set_envs

def set_envs(envs: Dict[str, str]) -> "DockerfileParserInterface"
Handle ENV instruction.

set_start_cmd

def set_start_cmd(start_cmd: str,
                  ready_cmd: str) -> "DockerfFileFinalParserInterface"
Handle CMD/ENTRYPOINT instruction.

parse_dockerfile

def parse_dockerfile(dockerfile_content_or_path: str,
                     template_builder: DockerfileParserInterface) -> str
Parse a Dockerfile and convert it to Template SDK format. Arguments:
  • dockerfile_content_or_path - Either the Dockerfile content as a string, or a path to a Dockerfile file
  • template_builder - Interface providing template builder methods
Returns: The base image from the Dockerfile Raises:
  • ValueError - If the Dockerfile is invalid or unsupported

wait_for_port

def wait_for_port(port: int)
Generate a command to wait for a port to be available.

wait_for_url

def wait_for_url(url: str, status_code: int = 200)
Generate a command to wait for a URL to return a specific status code.

wait_for_process

def wait_for_process(process_name: str)
Generate a command to wait for a process to be running.

wait_for_file

def wait_for_file(filename: str)
Generate a command to wait for a file to exist.

wait_for_timeout

def wait_for_timeout(timeout: int)
Generate a command to wait for a specified duration.

TemplateBase

class TemplateBase()

skip_cache

def skip_cache() -> "TemplateBase"
Skip cache for the next instruction (before from instruction)

from_image

def from_image(
        base_image: str,
        registry_config: Optional[RegistryConfig] = None) -> TemplateBuilder
Private method to set base image without adding stack trace

from_dockerfile

def from_dockerfile(dockerfile_content_or_path: str) -> TemplateBuilder
Parse a Dockerfile and convert it to Template SDK format Arguments:
  • dockerfile_content_or_path - Either the Dockerfile content as a string, or a path to a Dockerfile file