SchildiChat / schildichat-desktop

Matrix client / Element Web/Desktop fork
https://schildi.chat
Apache License 2.0
371 stars 42 forks source link

Allow building using docker. #145

Closed PaarthShah closed 1 year ago

PaarthShah commented 1 year ago

At the time of writing, I blindly took the installation requirements from the README, and some dockerfile directives from element-desktop/dockerbuild/Dockerfile in order to construct this current Dockerfile. So far, I think it looks cleaner, though it definitely does not yet implement caching, and I only wrote a single new target make docker-pacman as a proof-of-concept.

But I'm definitely interested in doing this properly/implementing this further if there's any interest, and if this could help others build/develop on schildichat, and helping CI get going for the main devs.

su-ex commented 1 year ago

Would this be feasible for podman somehow too? Or make it work for both through some sort of env var? I'm definitely interested in this for easing the build process!

su-ex commented 1 year ago

I've now taken a look at this. Since I'm using podman instead of docker I've reimplemented this in a more flexible way (both should work now probably) and also added a Containerfile for building rpm on latest Fedora which I plan to distribute from now on as well.

Thanks for this, I've got a lot of inspiration from it. :+1:

If you've got an idea how to improve this and make it more efficient, please let me know! 🙂 For example, I had to copy the project folder into the image instead of using it as a volume due to stuff breaking (node dependencies and that encryption stuff) if shared between host and different containers. However, building the images takes far longer this way. :mantelpiece_clock:

PaarthShah commented 1 year ago

@su-ex Aaa sorry for not seeing your older comment!

But I'm really glad that this was a good source of inspiration! Everything you're saying makes sense.

Slower build times honestly seem like a bit of a non-issue given that most people aren't going to build it themselves. I assume you'd still be able to build it on bare metal most of the time, and podman is just a convenience for being able to build for multiple environments, or for people to build it themselves with no fuss.

su-ex commented 1 year ago

@PaarthShah Indeed, podman is of great use for me to build all the different variants for different platforms. I've also discovered that the longer times of creation for the images can be quite worth it (especially if the same image is used multiple times later), because it allows high parallelization through separation, e.g. make -j 24 container-web-release container-debian-release container-rpm-release container-appimage-release. Element's build process is apart from the rust stuff in between not quite multithreaded, but this way I can utilize my my multi-core CPU far better. 🥳

So thanks again, you've helped me advance my build process a lot and hopefully also helped others to build schildi with more ease (oh right, building containerized should be mentioned in the readme 💡😆)!

cloudrac3r commented 1 year ago

@PaarthShah This is awesome, thanks so much. It's really helped me to test out my local builds. The non-container process was giving me so much grief. I normally hate Docker, but this works so well and I have no complaints. Great work to you and su-ex! ❤