🐳 🎉 dockerized version of awscli-local#90
🐳 🎉 dockerized version of awscli-local#90marcellodesales wants to merge 6 commits intolocalstack:masterfrom
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.
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.
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.
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.
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 <129442476+mattviasat@users.noreply.github.com>
|
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 |
If you are running localstack in one docker container, than i believe you should already have the image stored locally.
|
🎉 New Version
🏗️ Build
🏃 Running
✅ Testing
🔧 Localstack Deployment
🔧 AWS Lambda Deploy example