CustomPiOS icon indicating copy to clipboard operation
CustomPiOS copied to clipboard

Add a persistent /build_cache directory?

Open EternityForest opened this issue 3 years ago • 3 comments

Just a minor thing, but it could be a major help in some cases. What if we had a directory in the workspace that was mounted at /build_cache, and persisted between builds?

This would let you download very large files within build scripts without wasting bandwidth.

I can make a PR or work on this myself if there is interest!

EternityForest avatar Jul 04 '21 20:07 EternityForest

Could be done, the question is what are you trying to use it for? In a way you already have this with BASE_APT_CACHE https://github.com/guysoft/CustomPiOS/blob/devel/src/modules/base/config#L60

The code for that happens here: https://github.com/guysoft/CustomPiOS/blob/devel/src/custompios#L115

guysoft avatar Jul 04 '21 21:07 guysoft

I'm currently using a forked version with just these lines added, and I use it for a lot of things, like automatically fetching things from git repos, and for downloading the .NET runtimes. It's also useful for compiling things. There's no reason to recompile something when not much has changed, I can just do the whole compile right in the /build_cache.

  mkdir -p $BASE_WORKSPACE/build_cache
  mkdir -p $BASE_MOUNT_PATH/build_cache
  mount --bind $BASE_WORKSPACE/build_cache $BASE_MOUNT_PATH/build_cache

EternityForest avatar Nov 17 '21 16:11 EternityForest

ZynthianOS have a similar thing, what they do is place under the filesystem module what they have built and then unpack it in to the build. I can see how a cache could be helpful, but thinking what kind of commands you would want to run in the build could help. You could have seperate builds steps that use for example custompios_export commands and then move the results in to a filesystem section of a module. The thing with a cache is that it can change during the build, this way you have definitive steps you could run.

Or you could build a base image, then use CustoPiZer which is what OctoPrint and OctoPi-Klipper do.

I can understand how what you do helps you, and it might be helpful to others and worthwhile to put in, I am just not sure of the structure yet and the solutions above are a more structured way to get stuff in to the image.

guysoft avatar Nov 17 '21 18:11 guysoft