-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Compile to binary #128
Comments
@speller please add more info what/which dependency is causing issues. |
I'm not proficient in Python, so I can't say what's missing. I don't know anything about compiling Python programs to binaries. But having a binary pushed to GitHub releases would be super useful. And it also would be super nice if it will work under the Alpine linux. |
The docket images are actively used and are built based on alpine. See this: https://github.com/okigan/awscurl/blob/master/Dockerfile
… On Sep 4, 2021, at 11:43 PM, Alexander Pravdin ***@***.***> wrote:
@speller please add more info what/which dependency is causing issues.
I'm not proficient in Python, so I can't say what's missing. I don't know anything about compiling Python programs to binaries. But having a binary pushed to GitHub releases would be super useful. And it also would be super nice if it will work under the Alpine linux.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
What's the binary path then? The entrypoint says that it is run as a python script, not as a binary as I understood: |
Could you let me know what files should I copy from the awscurl docker image to make it working locally on another Alpine-based image? |
I've managed to compile by myself. Here is my Dockerfile code that builds
Versions:
The new entrypoint file
I guess you will need the |
The following Dockerfile code is used to compile binary under Python 3.9 Alpine 3.16
Versions:
This allows adding only binary to my image without pulling Python and raw sources. @okigan would you consider adding binaries only to the docker build instead of sources? It doesn't make sense to pull Python when only awscurl is required. And it also will simplify adding awscurl to custom docker images. Saving images' size as much as possible makes sense in deployment pipelines where many images are downloaded often, and bigger images slow down the whole process. |
First of all, thank you for looking into this! I have not used pyinstaller before so I looked at the relevant docs. Some of the internal caveats make me concerned Also, if awscurl "was compiled to executable" I would like more context how that would be distributed/consumed. (feel free to respond here or grab some time at https://calendly.com/okigan/30min) |
@okigan My use cases:
COPY --from=okigan/awscurl /usr/local/bin/awscurl /usr/local/bin/awscurl Otherwise, without the binary, I will have to install sources and Python to make it work, which will increase the resulting image size significantly. You may see in my latest example that I use multi-stage build to compile the binary and then copy only it to my image, dropping off Python, sources, and all dependencies. I add many tools to my image so, again, the size is important. I'm building my custom image on top of the Docker base image for my purposes (which is based on Alpine). If you will make an image with the binary only, you most probably will use the pure Alpine base image. Does this clarify the context of the binary usage? |
You may also redistribute the tool as precompiled binaries for different platforms if you wish. I install some tools in my images by downloading binaries. This also helps to save size and time. |
so I think your flow creates an "uber" docker image with all the necessary tools. And precompiled binaries are a way to avoid conflicts between the different tools. in the pyinstaller step, the specific binaries are compiled for your version of the (alpine) OS. If this binaries are published I think we'd need to keep them updated per (worst case) OS version (which seems a lot of ongoing work) if your and awscurl docker image is based on the same alpine base image the extra download should be rather small (i.e. docker does the diff for you) Maybe the issue we could make the base image more reusable, i.e adjusting this line: |
From my experience, the majority of linux binaries work well under alpine if they're compiled without external dependencies. In some cases, binaries compiled under any alpine could be required.
Yes, if it will contain a binary then it would solve my issue. |
Any updates? |
So this is still not officially supported, I've created a repo to create standalone awscurl (mostly based on what you've figured out above), additional image size seem within expected [see snapshot]. And there is Makefile to build and run/test that standalone awscurl work. |
It would be nice to have a possibility to compile awscurl to a binary for optimal disk space usage especially in Docker containers. It's hard to pull all the dependencies required for the program to work. Particularly, I'm building an image for CI/CD that will have awscurl installed.
The text was updated successfully, but these errors were encountered: