From 0b631ade280f76551fe6580b37ae0136a945276c Mon Sep 17 00:00:00 2001 From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:39:56 +0100 Subject: [PATCH 1/2] docs: Add low level API access --- .github/workflows/cicd.yml | 2 ++ .github/workflows/codeql-analysis.yml | 2 ++ docs/api/low_level_api_access.md | 9 +++++++++ mkdocs.yml | 1 + 4 files changed, 14 insertions(+) create mode 100644 docs/api/low_level_api_access.md diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 50cc7ac92..4f89e7f4f 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -3,8 +3,10 @@ name: Continuous Integration & Delivery on: push: branches: [ develop, main, bugfix/*, feature/* ] + paths-ignore: [ 'docs/**', 'examples/**' ] pull_request: branches: [ develop, main ] + paths-ignore: [ 'docs/**', 'examples/**' ] workflow_dispatch: inputs: publish_nuget_package: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6c9f7fa01..59182a38b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,8 +3,10 @@ name: CodeQL on: push: branches: [ develop, main ] + paths-ignore: [ 'docs/**', 'examples/**' ] pull_request: branches: [ develop, main ] + paths-ignore: [ 'docs/**', 'examples/**' ] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} diff --git a/docs/api/low_level_api_access.md b/docs/api/low_level_api_access.md new file mode 100644 index 000000000..945fc0960 --- /dev/null +++ b/docs/api/low_level_api_access.md @@ -0,0 +1,9 @@ +# Low level API access + +Testcontainers does not expose all available [Docker Engine APIs](https://docs.docker.com/reference/api/engine/latest/) through its container, image, network, and volume builders. In some cases, you may need to access the underlying Docker Engine API to configure specific properties that are not available via Testcontainers' API. To access all available Docker Engine API properties for creating a resource, use the builder method: `WithCreateParameterModifier(Action)`. This method allows you to use a callback to configure the final payload that is sent to the Docker Engine. + +```csharp title="SettingĀ set the memory limit to 2GB" +const long TwoGB = 2L * 1024 * 1024 * 1024; +_ = new ContainerBuilder() + .WithCreateParameterModifier(parameterModifier => parameterModifier.HostConfig.Memory = TwoGB) +``` diff --git a/mkdocs.yml b/mkdocs.yml index 74bcffd12..8fed95fd5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -36,6 +36,7 @@ nav: - api/create_docker_image.md - api/create_docker_container.md - api/create_docker_network.md + - api/low_level_api_access.md - api/resource_reaper.md - api/resource_reuse.md - api/wait_strategies.md From 3e2e7334f0d616d30a27fa6aa4cbc12b9078c1bd Mon Sep 17 00:00:00 2001 From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:44:16 +0100 Subject: [PATCH 2/2] fix: Remove typo --- docs/api/low_level_api_access.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/low_level_api_access.md b/docs/api/low_level_api_access.md index 945fc0960..12f67ff74 100644 --- a/docs/api/low_level_api_access.md +++ b/docs/api/low_level_api_access.md @@ -2,8 +2,8 @@ Testcontainers does not expose all available [Docker Engine APIs](https://docs.docker.com/reference/api/engine/latest/) through its container, image, network, and volume builders. In some cases, you may need to access the underlying Docker Engine API to configure specific properties that are not available via Testcontainers' API. To access all available Docker Engine API properties for creating a resource, use the builder method: `WithCreateParameterModifier(Action)`. This method allows you to use a callback to configure the final payload that is sent to the Docker Engine. -```csharp title="SettingĀ set the memory limit to 2GB" +```csharp title="Setting the memory limit to 2GB" const long TwoGB = 2L * 1024 * 1024 * 1024; _ = new ContainerBuilder() - .WithCreateParameterModifier(parameterModifier => parameterModifier.HostConfig.Memory = TwoGB) + .WithCreateParameterModifier(parameterModifier => parameterModifier.HostConfig.Memory = TwoGB); ```