Skip to content

Commit 6b361b0

Browse files
committed
add platform
1 parent f7a8725 commit 6b361b0

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ env = {"MY_APP_ENV" = "dev"}
169169
labels = {"MY_APP_LABEL" = "dev"}
170170
apt-packages = ["curl"]
171171
extra-run-instructions = ["RUN curl https://huggingface.co/transformers/"]
172+
platform = "linux/amd64"
172173

173174
# Only for build docker layer
174175
build-apt-packages = ["gcc"]
@@ -188,6 +189,7 @@ build-poetry-install-args = ["-E", "all", "--no-root"]
188189
* `labels` append labels to the docker image. Default labels are added following the opencontainers specification.
189190
* `apt-packages` installs apt packages inside the docker image.
190191
* `extra-run-instructions` adds extra instructions to the docker run (after poetry install). Any modification to the filesystem will be kept after the poetry install.
192+
* 'platform' forces docker platform to be used.
191193

192194
For the build step:
193195
* `build-apt-packages` installs apt packages inside the build docker container.

dockerpyze/builder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class DpyConfiguration:
3131
extra_runtime_instructions: List[str] = []
3232
poetry_version: str = ""
3333
packages: list[str]
34+
platform: str = ""
3435

3536

3637
class ProjectConfiguration:
@@ -50,6 +51,7 @@ class ProjectConfiguration:
5051
app_packages: List[str] = []
5152
poetry_version: str = ""
5253
package_manager: Literal["uv", "poetry"]
54+
platform: str = ""
5355

5456

5557

@@ -80,6 +82,7 @@ def parse_toml(from_dict: dict) -> DpyConfiguration:
8082
config.extra_runtime_instructions = _from_env_or_dict_list_str("extra-runtime-instructions", from_dict)
8183
config.poetry_version = _from_env_or_dict_str("poetry-version", from_dict)
8284
config.packages = _from_env_or_dict_list_str("packages", from_dict)
85+
config.platform = _from_env_or_dict_str("platform", from_dict)
8386
return config
8487

8588

@@ -447,7 +450,8 @@ def build(
447450
path=real_context_path,
448451
dockerfile=dockerfile,
449452
tag=full_image_name,
450-
rm=False
453+
rm=False,
454+
platform=config.platform or None,
451455
)
452456
if verbose:
453457
print_build_logs(decoder)

0 commit comments

Comments
 (0)