Why apk doesn't cache packages if /etc/apk/cache is on tmpfs?
I’m sure it’s a minor issue. But is there any specific reason apk ignores /etc/apk/cache if the filesystem is tmpfs?
If I’ve find out correctly the code is here: http://git.alpinelinux.org/cgit/apk-tools/tree/src/database.c\#n1590
If you wonder why would I have a cache on tmpfs anyway. It’s because we use alpine for containers. And when building many containers we usually reuse some packages. And with typical uptime of a laptop of a month or so, it’s fine to keep cache on tmpfs.
Anyway, here is the issue that was a motivation for this one: https://github.com/tailhook/vagga/issues/259
(from redmine: issue id 5616, created on 2016-05-22, closed on 2017-05-22)
- Revision c0f2d88f by Timo Teräs on 2017-02-27T09:05:01Z:
db: allow caching packages on tmpfs fixes #5616 The original intention was not use unnecessary space on tmpfs e.g. if the cache directory is a mount point, but accidentally left unmounted. But there are valid cases when packages are intentionally wanted to be cached on tmpfs. If caching is not desired, the user can just remove the cache directory.