Is there any facility to pass a `--build-arg` for ...
# ask-community
l
Is there any facility to pass a
--build-arg
for a Dockerfile to the prefect register CLI command?
k
Hey @Leon Kozlowski, just got to looking at this and I think you’re right
l
It looks like that should be correct but I’m getting a
TypeError
Copy code
TypeError: build() got an unexpected keyword argument <MY_ARGUMENT>
I could be wrong on this but, when running the
docker.APIClient().build(…)
function here I believe they
build_kwargs
on prefect side should be passed
buildargs
on the docker side
k
Could you show me how you used it?
l
Copy code
# Building flow storage via `prefect.storage`
flow.storage = Docker(
    dockerfile="Dockerfile",
    env_vars=config.ENVIRONMENT_VARIABLES,
    image_name=config.DOCKER_IMAGE_NAME,
    image_tag=config.DOCKER_IMAGE_TAG,
    registry_url=config.DOCKER_REGISTRY_URL,
    build_kwargs={"MY_ARGUMENT": os.getenv("MY_ARGUMENT")},
)  # pragma: no cover
k
Will give it a shot.
Try
Copy code
flow.storage = Docker(
    build_kwargs={"buildargs":{"MY_ARGUMENT": "YO"}},
)
🙌 1
l
I have another error 🙂 but thank you Kevin!
k
You did all the investigation there 😆
😀 1