-
Notifications
You must be signed in to change notification settings - Fork 840
Enable docker build by only cloning the repository #604
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
| author="Joel Martin", | ||
| author_email="github@martintribe.org", | ||
|
|
||
| packages=['websockify'], | ||
| packages=find_packages(), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this is a plus, given we have such a simple project. Explicitly listing them gives you some protection against including any random junk that people might have in their working copy.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why, but I only got it to work succesful this way. When explicity stating the package, the build always fails with a message that the folder or package can not be found, even if they have the exact same name as the directory it is in... I can do some tests again and give the error message maybe somone meight have more insight and makes the build without needing this change.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do and share the error here.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I posted into the wrong comment... |
||
| include_package_data=True, | ||
| install_requires=[ | ||
| 'numpy', 'requests', | ||
|
|
||
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.
What are we losing in this switch? We have a bunch of optional dependencies, like numpy, that users probably want.
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.
There is essentially nothing lost, only gained.
With the slim version the final image size reduced by only having the necessary runtime requirenments for python.
With specifying version 3 the builds are more explicit which helps anybody reading the Dockerfile, and making the build more predictable by actually being explicit to the dependend python version (Imagine python 4 is released and the dockerfile simply states python with an implicit latest).
By using the slim version there is less traffic ~1.2GB vs ~200MB and less stored.
Also by splitting the build into two stages the size is also reduced by only copying the necessary files to the final image, leaving any cache, temporary files etc. behind.
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.
Forgott that there is nothing lost, the full requirenments are installed.
Only the base Image i think Debian or Ubuntu, is not installed in a full fledged way but in a minimal with python runtime.
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.
Okay, it seems like the Python side are indeed the same.
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.
When I run the build in the "specific_package" branch in the git root with the command
docker build -t websockify -f docker/Dockerfile .I get this error:
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 seems to be tied to the environment, if I wrap the statements in a shell script and execute them with bash it works just fine, but when executed as a plain command in the docker file in a RUN statement it somehow breaks...
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 have debugged a bit further and found that
find_packages()resolves to[]When I hardcode
packages=[]it builds just fine.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 have found the following section in the python docs:
~ https://docs.python.org/3.11/distutils/setupscript.html#listing-whole-packages
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.
While reading in https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
Another workaround I have found was to include
package_dir = {"websockify": ""},orpackage_dir = {"websockify": "."},orpackage_dir = {"websockify": "/"},This seems to be the least required amount of changes, to make the dockerfile work while leaving the statements in the dockerfile unchanged.
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'm afraid I cannot reproduce the issue here. And it really should work. The documentation you refer to states:
And since we say
packages=['websockify'], we claim that there is awebsockifydirectory next tosetup.py. Which there is.It seems like there is something more in your environment that is fouling thing.