Return a new container snapshot, with a directory added to its filesystem Parameters ---------- path: Location of the written directory (e.g., "/tmp/directory"). source: Identifier of the directory to write exclude:
(
self,
path: str,
source: "Directory",
*,
exclude: list[str] | None = None,
include: list[str] | None = None,
gitignore: bool | None = False,
owner: str | None = "",
expand: bool | None = False,
permissions: int | None = None,
)
| 2865 | return Container(_ctx) |
| 2866 | |
| 2867 | def with_directory( |
| 2868 | self, |
| 2869 | path: str, |
| 2870 | source: "Directory", |
| 2871 | *, |
| 2872 | exclude: list[str] | None = None, |
| 2873 | include: list[str] | None = None, |
| 2874 | gitignore: bool | None = False, |
| 2875 | owner: str | None = "", |
| 2876 | expand: bool | None = False, |
| 2877 | permissions: int | None = None, |
| 2878 | ) -> Self: |
| 2879 | """Return a new container snapshot, with a directory added to its |
| 2880 | filesystem |
| 2881 | |
| 2882 | Parameters |
| 2883 | ---------- |
| 2884 | path: |
| 2885 | Location of the written directory (e.g., "/tmp/directory"). |
| 2886 | source: |
| 2887 | Identifier of the directory to write |
| 2888 | exclude: |
| 2889 | Patterns to exclude in the written directory (e.g. |
| 2890 | ["node_modules/**", ".gitignore", ".git/"]). |
| 2891 | include: |
| 2892 | Patterns to include in the written directory (e.g. ["*.go", |
| 2893 | "go.mod", "go.sum"]). |
| 2894 | gitignore: |
| 2895 | Apply .gitignore rules when writing the directory. |
| 2896 | owner: |
| 2897 | A user:group to set for the directory and its contents. |
| 2898 | The user and group can either be an ID (1000:1000) or a name |
| 2899 | (foo:bar). |
| 2900 | If the group is omitted, it defaults to the same as the user. |
| 2901 | expand: |
| 2902 | Replace "${VAR}" or "$VAR" in the value of path according to the |
| 2903 | current environment variables defined in the container (e.g. |
| 2904 | "/$VAR/foo"). |
| 2905 | permissions: |
| 2906 | """ |
| 2907 | _args = [ |
| 2908 | Arg("path", path), |
| 2909 | Arg("source", source), |
| 2910 | Arg("exclude", [] if exclude is None else exclude, []), |
| 2911 | Arg("include", [] if include is None else include, []), |
| 2912 | Arg("gitignore", gitignore, False), |
| 2913 | Arg("owner", owner, ""), |
| 2914 | Arg("expand", expand, False), |
| 2915 | Arg("permissions", permissions, None), |
| 2916 | ] |
| 2917 | _ctx = self._select("withDirectory", _args) |
| 2918 | return Container(_ctx) |
| 2919 | |
| 2920 | def with_docker_healthcheck( |
| 2921 | self, |