MCPcopy Create free account
hub / github.com/dagger/dagger / docker_build

Method docker_build

sdk/python/src/dagger/client/gen.py:4449–4500  ·  view source on GitHub ↗

Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features. Parameters ----------

(
        self,
        *,
        dockerfile: str | None = "Dockerfile",
        platform: Platform | None = None,
        build_args: list[BuildArg] | None = None,
        target: str | None = "",
        secrets: "list[Secret] | None" = None,
        no_init: bool | None = False,
        ssh: "Socket | None" = None,
    )

Source from the content-addressed store, hash-verified

4447 return Directory(_ctx)
4448
4449 def docker_build(
4450 self,
4451 *,
4452 dockerfile: str | None = "Dockerfile",
4453 platform: Platform | None = None,
4454 build_args: list[BuildArg] | None = None,
4455 target: str | None = "",
4456 secrets: "list[Secret] | None" = None,
4457 no_init: bool | None = False,
4458 ssh: "Socket | None" = None,
4459 ) -> Container:
4460 """Use Dockerfile compatibility to build a container from this directory.
4461 Only use this function for Dockerfile compatibility. Otherwise use the
4462 native Container type directly, it is feature-complete and supports
4463 all Dockerfile features.
4464
4465 Parameters
4466 ----------
4467 dockerfile:
4468 Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
4469 platform:
4470 The platform to build.
4471 build_args:
4472 Build arguments to use in the build.
4473 target:
4474 Target build stage to build.
4475 secrets:
4476 Secrets to pass to the build.
4477 They will be mounted at /run/secrets/[secret-name].
4478 no_init:
4479 If set, skip the automatic init process injected into containers
4480 created by RUN statements.
4481 This should only be used if the user requires that their exec
4482 processes be the pid 1 process in the container. Otherwise it may
4483 result in unexpected behavior.
4484 ssh:
4485 A socket to use for SSH authentication during the build
4486 (e.g., for Dockerfile RUN --mount=type=ssh instructions).
4487 Typically obtained via host.unixSocket() pointing to the
4488 SSH_AUTH_SOCK.
4489 """
4490 _args = [
4491 Arg("dockerfile", dockerfile, "Dockerfile"),
4492 Arg("platform", platform, None),
4493 Arg("buildArgs", [] if build_args is None else build_args, []),
4494 Arg("target", target, ""),
4495 Arg("secrets", [] if secrets is None else secrets, []),
4496 Arg("noInit", no_init, False),
4497 Arg("ssh", ssh, None),
4498 ]
4499 _ctx = self._select("dockerBuild", _args)
4500 return Container(_ctx)
4501
4502 async def entries(self, *, path: str | None = None) -> list[str]:
4503 """Returns a list of files and directories at the given path.

Callers 15

test_container_buildFunction · 0.80
test_input_argFunction · 0.80
test_service_start_stopFunction · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80

Calls 3

ArgClass · 0.90
_selectMethod · 0.80
ContainerClass · 0.70

Tested by 3

test_container_buildFunction · 0.64
test_input_argFunction · 0.64
test_service_start_stopFunction · 0.64