Faster Docker build directly on host #10
Loading…
Reference in New Issue
No description provided.
Delete Branch "nutomic/lemmy:faster-docker-build"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I couldnt deal with the long build times to run federation tests, so I had the idea of doing it this way instead. Unfortunately its not working, the resulting Docker image always crashes with this error:
Any clue what the problem could be?
https://stackoverflow.com/questions/51508150/standard-init-linux-go190-exec-user-process-caused-no-such-file-or-directory
Alpine doesn't have bash, so you have to do
#!/bin/sh
for the script.But its not running bash inside the container, just the Lemmy binary that is copied in. Basically the same as the existing Docker image (unless I am missing something).
Edit: To be clear, the
run-federation-test.bash
(and the actual build) run outside of Docker.Hrm, I'm not sure. I've seen that error with docker before tho, docker doesn't play well with scripts as entrypoints from what I could see.
Okay I found it, it was this problem: https://stackoverflow.com/questions/49098753/unable-to-run-a-docker-image-with-a-rust-executable
I fixed it by using the musl-builder image instead of Alpine. Installing libc might also fix the problem, but it doesnt matter much as its only for debugging.
Unfortunately its still not working entirely, the console doesnt show any errors now but the website says only
No such file or directory (os error 2)
. No idea what file it means, config is loaded and the ui folder also looks correct.What the hell, I didnt change anything but its working now. One remaining problem I have is that the yarn build is run every time, is it possible to skip that if none of the ui files changed?
Other than that, the PR should be ready to merge.
Edit: Maybe this was fixed by me wiping my Docker volumes, so maybe we need to use seperate volumes here. Just a guess though.
I'll start building this on my machine, I know it'll take a while lol.
Yup works good! One thing that's a little annoying, is that we need to clear storage when going from one instance to another, but I've never looked up how to scope browser storage to a specific port number, since they're mainly based on domain name (and when testing, both use localhost obvi).
An easier fix, which we might have to do eventually anyway, is add some /etc/hosts manipulation to this bash script.
What about the thing I mentioned, not running the yarn build if nothing changed?
Its not too big of a deal IMO, since the yarn fuse build takes an average of < 10 seconds. Docker is just smart and knows that if nothing in the folder has changed, don't even run the command, just used the cached version. And rust seems to also be smart by looking in the target folder too.
Yeah but saving 10 seconds on every build would also be nice. Sucks that yarn is not smart enough for that.