-
Notifications
You must be signed in to change notification settings - Fork 92
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
π³ π dockerized version of awscli-local #90
base: master
Are you sure you want to change the base?
π³ π dockerized version of awscli-local #90
Conversation
* Add specific versions in docker-compose * Add correct entrypoint execution
The binary needs to use the venv python installed to avoid using the one from the system. A new version must remove this step to avoid confusion and end up having 2 python installations in the same docker image. For now, since there are multiple python instances, the system is pointing to an older version, while venv has a newer version python 3.13. So, the awslocal-docker has the proper call as the order of PATH needs to be respected so that the AWS-cliv2 is loaded beore aws-v1 added by the python bindings.
>>> import awscli Traceback (most recent call last): File "<python-input-0>", line 1, in <module> import awscli ModuleNotFoundError: No module named 'awscli' >>>
@@ -0,0 +1,269 @@ | |||
#!/venv/bin/python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you are copy/pasting the entire file just to change the shebang. That will be difficult to maintain and seems unnecessary.
Since you already change the path with PATH="/venv/bin:$PATH"
, it should automatically use the virtualenv because /venv/bin/python
is the first python
that will be found. E.g.
$ python3 -m venv /tmp/venv
$ PATH="/tmp/venv/bin:$PATH" which python
/tmp/venv/bin/python
I would remove bin/awslocal-docker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the problem here is to support both aws-cliv2 and the aws-cli python bindings... Couldn't find a way to specify them, but I will try to remove it...
|
||
# Add awslocal to site-packages/bin, with priority to awsv2 bin | ||
# As awscli is added for the bindings, v1 will be also added | ||
COPY bin/awslocal-docker /venv/bin/awslocal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the copy of the file
COPY bin/awslocal-docker /venv/bin/awslocal | |
COPY bin/awslocal /venv/bin/awslocal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the whole problem here is that the image has python 3.13 installed with the command venv creation... I will remove that step and see if it's possible to keep a single installation and, as a result, decrease the image size.
Co-authored-by: mattviasat <[email protected]>
The other thing I would say is that it might be easier to just call awslocal inside the existing localstack image, rather than creating a new image that just containers awslocal. |
Thank you for all your suggestions... I just need a smaller image to account for SBOM, security, etc... This is specific for a cloudNative platform and I don't need to pull the entire localstack image for the use cases that I have... |
I think there is probably a simpler way that results in a smaller image. You could use python3 -m venv /venv/
/venv/bin/python3 -m pip install --no-cache-dir awscli-local
/venv/bin/awslocal help |
π New Version
ποΈ Build
π Running
β Testing
π§ Localstack Deployment
π§ AWS Lambda Deploy example