Faster Docker build directly on host #10

Manually merged
nutomic merged 1 commits from nutomic/lemmy:faster-docker-build into federation 2020-01-10 19:56:40 +00:00
Owner

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:

standard_init_linux.go:211: exec user process caused "no such file or directory"

Any clue what the problem could be?

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: ``` standard_init_linux.go:211: exec user process caused "no such file or directory" ``` Any clue what the problem could be?
Owner
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.
Author
Owner

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.

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.
Owner

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.

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.
Author
Owner

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.

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.
Author
Owner

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.

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.
Owner

I'll start building this on my machine, I know it'll take a while lol.

I'll start building this on my machine, I know it'll take a while lol.
Owner

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.

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.
nutomic closed this pull request 2020-01-10 19:56:40 +00:00
Author
Owner

What about the thing I mentioned, not running the yarn build if nothing changed?

What about the thing I mentioned, not running the yarn build if nothing changed?
Owner

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.

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.
Author
Owner

Yeah but saving 10 seconds on every build would also be nice. Sucks that yarn is not smart enough for that.

Yeah but saving 10 seconds on every build would also be nice. Sucks that yarn is not smart enough for that.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: LemmyNet/lemmy#10
No description provided.