nroi / cpcache

central pacman cache
MIT License
15 stars 3 forks source link

Rework docker content #27

Closed jarda-wien closed 4 years ago

jarda-wien commented 4 years ago

This PR updates the available docker content to be more "publish friendly". I think it would be great if cpcache had an official dockerhub image.

I am moving to a new Ubuntu-based router and wanted to use cpcache dockerized. There were two reasons for me to start this work: 1) The main Dockerfile builds an image, which is more a testing environment, than a finished packaged application. For instance, it should run with an interactive shell. Additionally, the image is rather big. 1) A cpcache docker image is available on dockerhub https://hub.docker.com/r/improwised/cpcache , but this appears to be just a copy & paste of the Dockerfile from this repo with all the issues.

As I know nothing about elixir, I have taken heavy inspiration from your own AUR package. Here is a screenshot comparison of image size produced: image

The proposed version is missing one more important step to consider it "cloud-ready" -> environment based configuration. I could have written a wrapper around the main toml config, but I figured that if you really wanted to go through this exercise properly, it would be much better to adjust the application itself to take its config via environment vars.

Let me know what you think. I've been using my version a few days serving all my arch machines and it works like a charm.

nroi commented 4 years ago

Thank you for your PR. Regarding the environment variables, this is something I will definitely consider for the successor project of cpcache: https://github.com/nroi/flexo

I've also created an issue to improve the docker image for flexo: https://github.com/nroi/flexo/issues/2 I wouldn't recommend to dive into flexo just yet, because it is still a work in progress, but if you care about docker and small image sizes, perhaps you want to keep a look on this project and this particular issue. Flexo is written in Rust, so it should be much easier to write a docker file that results in a lean image.