-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Upload docker image to dockerhub #171
Comments
Thank you for raising this issue. I have been trying every week, however I have failed to do so successfully over the past 2 weeks because of the VPN inability 😭. |
Most developers only use javet or edit the javet source code without directly modifying the source code of V8 |
I don't think that is a good idea. Those binary files could reach tens of GBs so that cloning this project would be impossible. |
@caoccao we could setup the github actions, such that any tagged commit gets its docker image built and push to dockerhub. I could do a PR for that if needed. |
Here are the challenges for your reference.
If you could resolve these challenges, I would be happy to merge your PR. By the way, I'm using an VPN to get out of China mainland. That VPN charges me by the data volume. It would take 20+GB per base image. That's a heavy financial burden to me. |
Ok. I may have misunderstood something. What is the purpose of the uploaded docker image? From the dockerfile in the repo, it looks like the image is used to build the Javet binaries. Is the build image primarily for people wanting to contribute to Javet development? And not meant for users of Javet? |
Keeping aside the question of why is the image needed, we can tackle the concerns raised,
From the documentation for limits on actions, https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits
Maybe the 1 hour limit you mentioned was an older limit? If I have missed something, please correct me.
Do we need the source code to be present in the final built image? Docker has the concept of multi-stage builds, where we use one image to build the compiled files and then copy the compiled files to another image. The resultant final image is much smaller. As an example, using multi stage builds, a user was able to reduce the size of the V8 image from 5GB to 0.47GB. Reference We can apply the same concept to building Node (though I am not sure why are we building Node instead of installing it). To speed up the overall build, we can choose to build the V8 image independently from the Node image and refer both in the multi-stage build for Javet base. It won't be trivial to do, but if you could help me understand what is happening and what is actually needed (ie only compiled binaries and no source), then I can attempt something. |
Thank you for the help.
It's for building and testing every commit. I think I was perceived by some document about the 1 hour limit. Thank you for correcting me. Regarding shrinking the image, it's tricky because Javet references the source code directly as well as the libraries. That implies the whole build environment, source code and .obj files are supposed to be in the image. You may take a try and find out how much you may drop. The largest image layer is 5+GB so that the connection to docker hub drops so frequently. Especially, as I'm behind the VPN, I haven't pushed such image successfully over the past few months. I doubt how stable the connection between github and docker hub. |
Reading through the Dockerfile and build scripts for linux, it looks like for the V8 build of Javet it only needs the V8 source and compiled folders. For the Node build of Javet, does it only need the Node source and compiled folders, or does it need the V8 ones as well? If they are independent, then we can split the images, reducing their size further. However, if the Node build requires the V8 bits as well, we can base the Node image off the V8 image. The idea is instead of one huge 15gb image, we might have three images of 5gb each (these numbers are assumptions) - a V8 image, a Node image based off the V8 image, and a Javet image based off the Node image. The V8 and Node image will change maybe once every 4-6 weeks as per their release cycles. The 3rd Javet image may change more frequently, though that might be much smaller in size. Just ideas in my head atm. |
Nice. I had some trouble setting up an Ubuntu VM on my Windows 10 + WSL2 desktop. Need to figure out the details. Once that is done, I should be able to actually build the existing docker images. Give me a few days to figure things out. |
That will be great. Thank you very much. |
嘿嘿 |
@caoccao In my excitement for solving a technical challenge, I think I missed out on understanding the purpose of the image. Let me state my current understanding and ask clarifying questions. The latest image on https://hub.docker.com/r/sjtucaocao/javet/tags is tagged
I can see in the Github workflow, that this image is used to test the code on every pull request, and to build the jar files and upload them as artifacts.
3.1. I understand the desire to cache the dependency jar files using gradle in the 3.2. Instead we strip the What do you think about the points I raised? Am I missing anything? |
maybe most users only use Javet products, but some customization needs should be taken into account. This requires this image to build Javet. Uploading to DockerHub is a quick way |
@caoccao An update. I was able to build the V8_Node image using a GitHub Action. It took a little over 3 hours! The docker image ( The docker upload of the image from GitHub to DockerHub took around 7 mins. Can you please use the image and test it? In the folder where you have the Javet source clone, please run the following. The
In the resulting shell, execute the following manually,
In your local machine, the javet jar should be present at The GitHub runner has a hardware limitations to keep in mind. I don't think we will hit them anytime soon.
If you can confirm the docker image works, and is suitable for use, then I will continue with next steps. Example workflow - https://github.com/amithgeorge/v8-node-source-binaries/blob/d71b4ea03f640587a3ed07a951fabcc3b831a218/.github/workflows/linux_build_dev.yml Result of the action - https://github.com/amithgeorge/v8-node-source-binaries/actions/runs/3298958302 The docker image - https://hub.docker.com/layers/amithgeorge/javet-linux-dev/v8-10.6.194.14_node-18.10.0/images/sha256-42332c776174da067d0dd03dc4b97978a0c757ab44a1ac14696d53a5fad18ff7 |
Thank @amithgeorge for the great work. I'll check that out later. Here are some tips for your reference.
|
Thank @amithgeorge for the great work。Can you upload Android and Windows image |
@sornian this is still a work in progress. The linux image is currently uploaded to my person DockerHub repo. Ideally, these images should be hosted on the Javet DockerHub. So, I would strongly advise against relying on the images I am uploading. These are mainly to test whether I am on the right track. I do not guarantee these images will remain for more than a few days. I have never worked on Android/ARM or Windows docker images before. So I am not even sure whether I would be able to contribute towards that. My idea was to setup something for Linux, bring it under the Javet org/brand. Then @caoccao or someone with appropriate experience can rely on that to similarly implement the infra for Android and Windows. From @caoccao's earlier message, it sounds like there is some overlap between Linux and Android images, so I might take a stab at Android as well later. |
I tried it out today. Thank @amithgeorge for the excellent work! Here are few suggestions.
Please feel free to create a new branch with the changes and I'll review it whenever you want me to. Thank you again for you great help. |
I've also been working on getting the docker builds working, and did some experimentation breaking it into a multi-stage build. I'm ultimately trying to get arm64 working so it can be used on some of the raspis some of my friends are running, so I've been working with combinations of |
There might be some confusion, I ran into the |
|
I don't think |
That's weird because it works in my environment (Windows 10 + WSL 2 + Docker + Ubuntu 20.04). May I know your environment? |
I tried on both my Ubuntu 22.04 systems, but also inside a podman container VM which uses fedora-coreos-36.20221014.2.0. So it is the kernel that's kind of responsible, but from what I could tell, the After talking to someone from the chromium mailing group, it sounds like the libs that |
I found another upside to the multi-stag approach is it seems to multi-thread very nicely with the |
I wonder if mounting a physical volume as |
It would get rid of the error, but that's just because you're copying the data, which makes it owned by that layer. |
Right, that's also one of my concerns. The image size might be nearly doubled if that's not taken well care of. Let the test tell us if that's a valid concern. |
I was trying to reduce the time it takes to build the image on GH and reduce the overall size of the final image.
With this setup, I can build the v8 image in parallel to the Node.js image. Doing a full run of the workflow, it takes only
Links Worflow File (inputs to skip building a certain image) - https://github.com/amithgeorge/v8-node-source-binaries/blob/0621ee4e638bc11e7b31372580d3acc8ed2b67db/.github/workflows/linux_build_dev_parallel.yml#L8 Script to shallow clone and build V8 - https://github.com/amithgeorge/v8-node-source-binaries/blob/0621ee4e638bc11e7b31372580d3acc8ed2b67db/scripts/shell/fetch_v8_source Final image (no gradle deps yet, will add that later) - https://hub.docker.com/layers/amithgeorge/javet-linux-dev/v8-10.6.194.14_node-18.10.0_shallow/images/sha256-c02d7c80bd5e50274b00e2e7789e03906ce668d422e94ad3cd4b34c43f7fada1?context=explore |
I did some experiments with emulated It should technically be possible to have a single linux dockerfile build anything in this matrix
The only issue becomes (might be worth referencing the build-nodejs-for-android docker container and its use of the android-gcc-toolchain to do a few more):
Which I'm not sure an argument parser will be able to help with since the only way to skip a stage is with an environment variable that's set with |
Thank @amithgeorge for the wonderful update.
Cheers! |
Thank @josh-hemphill for the update.
I prefer them being separate images between the Android and Linux. I hold concerns on a mega image with both mainly because of the following.
As Node.js doesn't officially support Android, I don't want to support it on Android. Regarding Linux arm/arm64, someone else did that successfully.
That is something I have been holding myself not to do. I'd rather keep the build system:
Why? The build system of J2V8 left me with some negative experience. You are welcome taking a look at it as it is very close to what you described. I'm here against code reuse in such system because the external dependencies could easily break the assumptions relied on by the reusable modules and that would result in the collapse of the whole build system. |
Thanks for the clarification @caoccao . Regarding:
I wasn't suggesting combining the images; I'm writing a multi-stage dockerfile just so that the shared layers at the beginning are explicitly referenced and the same command/file can be used to build either (theoretically you could do both) just by changing the arguments you pass for which targets you want to build. As for keeping it as simple as possible, adding something like
to get docker build --jobs=0 ./docker/linux-x86_64/base.Dockerfile .
docker build --jobs=0 ./docker/linux-ia32/base.Dockerfile .
docker build --jobs=0 ./docker/linux-arm64/base.Dockerfile .
docker build --jobs=0 ./docker/linux-arm/base.Dockerfile . when more than 80% of the files are the same. Most people aren't going to build the |
Thank @josh-hemphill for the detailed explanation. I agree with the approach you proposed. Let's see if that could be coordinated with the redesign that @amithgeorge is working on. Would you mind joining the discord to have a group discussion in real-time? Thank you. |
I joined the discord, but I've got to get some get some sleep, so I'll have to talk tomorrow. |
@josh-hemphill In general, that looks fine. Here are few tips for your reference.
Thank you. |
@amithgeorge @josh-hemphill I just merged #216 to main. Please let me know if it matches the multi-staged build that you think. |
https://hub.docker.com/u/sjtucaocao
Images in docker hub is not the new version
I try to build base.docker but our country can't visit Google any website
Could you please upload the new image to docker hub
Please
The text was updated successfully, but these errors were encountered: