-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Docker image build kwargs is not working #706
Labels
Comments
class DockerImage:
...
def __init__(
self,
path: Union[str, PathLike],
docker_client_kw: Optional[dict] = None,
tag: Optional[str] = None,
clean_up: bool = True,
dockerfile_path: Union[str, PathLike] = "Dockerfile",
no_cache: bool = False,
**kwargs,
) -> None:
...
def build(self, **kwargs) -> Self:
logger.info(f"Building image from {self.path}")
docker_client = self.get_docker_client()
self._image, self._logs = docker_client.build(
path=str(self.path), tag=self.tag, dockerfile=self._dockerfile_path, nocache=self._no_cache, **kwargs
)
logger.info(f"Built image {self.short_id} with tag {self.tag}")
return self
...
def __enter__(self) -> Self:
return self.build() As can be seen maybe also take the time to add something like #614 |
WorkaroundJust use the lower level methods def test_something():
image = DockerImage(path="./", tag="new:test")
image.build(buildargs={"PIP_EXTRA_INDEX_URL": PIP_EXTRA_INDEX_URL})
with AWSLambdaContainer(image=image, port=8080) as func:
# Do Something with the container
image.remove() |
This was referenced Oct 1, 2024
I feel like this was my original issue with build args exactly :D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using kwargs in the Image API, the params are not passed into the
build
To Reproduce
For example:
The
PIP_EXTRA_INDEX_URL
fails to register in the docker image build process:The text was updated successfully, but these errors were encountered: