On ContainerImage class from_asset method in Python CDK the file parameter name is missing which makes it impossible to use this method.
Just use ContainerImage.from_asset(file='../Dockerfile', target='webserver') and that will throw a SyntaxError: invalid syntax error.
$ cdk diff
Traceback (most recent call last):
File "app.py", line 6, in
from airflow.airflow_stack import AirflowStack
File "/Users/msilva/Projects/airflow/airflow/airflow_stack.py", line 3, in
from aws_cdk.aws_ecs import Cluster
File "/Users/msilva/Projects/airflow/.env/lib/python3.7/site-packages/aws_cdk/aws_ecs/__init__.py", line 7214
: typing.Optional[str]=None, repository_name: typing.Optional[str]=None, target: typing.Optional[str]=None, extra_hash: typing.Optional[str]=None, exclude: typing.Optional[typing.List[str]]=None, follow: typing.Optional[aws_cdk.assets.FollowMode]=None) -> "AssetImage":
^
SyntaxError: invalid syntax
Subprocess exited with error 1
This is :bug: Bug Report
hey @mjsilva, the argument list for ContainerImage.fromAsset requires the positional argument directory. This is the directory used for the context of the docker build command. The keyword arg file is only required when using a dockerfile with a name other than Dockerfile. So you may be looking to call the function like so
ecs.ContainerImage.from_asset("path", file="Dockerfile.custom")
I tested this with cdk v1.33.0.
Thanks @MrArnoldPalmer after posting this I've done a bit more debugging and reinstalled all the pip packages and now seems to be working. Sorry about this looks my IDE messed the lib packages up.
Closing it as is a non-bug.
Most helpful comment
Thanks @MrArnoldPalmer after posting this I've done a bit more debugging and reinstalled all the pip packages and now seems to be working. Sorry about this looks my IDE messed the lib packages up.
Closing it as is a non-bug.