shaarli / Shaarli

The personal, minimalist, super-fast, database free, bookmarking service - community repo
https://shaarli.readthedocs.io/
Other
3.44k stars 294 forks source link

Migrate Docker images to Alpine Linux #843

Closed virtualtam closed 7 years ago

virtualtam commented 7 years ago

Motivations

Our Docker images are currently based on the debian:jessie base image, and weight around 300 MiB.

This is due to several reasons:

Alpine Linux is a lightweight and minimalist distribution tat revolves around:

The base image weights 4 MiB and comes with usage documentation to create lightweight service images.

Related articles/posts:

Proposed setup for Shaarli images

Note: Supervisor comes with a lot of Python dependencies (with respect to the expected image size) and might be replaced with runit to spare a few MiBs :)

Early results

I've started to fiddle with a new image, here are the early results (before attempting Dockerfile voodoo):

$ docker images

REPOSITORY          TAG             IMAGE ID            CREATED             SIZE
vt-shaarli          latest          b2268683c850        16 minutes ago      116 MB
shaarli/shaarli     latest          c13a3fa1ba4d        35 hours ago        289 MB
debian              jessie          8cedef9d7368        12 days ago         123 MB
alpine              3.5             4a415e366388        4 weeks ago         3.99 MB
ArthurHoaro commented 7 years ago

If apk provides all necessary packages, that's fine with me. We're talking about disk usage here, not RAM, right?

virtualtam commented 7 years ago

Alpine indeed provides system and PHP packages with good granularity (1 extension => 1 package)

The generated images are more lightweight (I've managed to go down to 75 MiB by replacing supervisor with S6), which means they take less storage space, and by extension use less RAM when running Docker appliances :)