Hi Julian,

Awesome to see you playing with Docker. I love Docker and I've been thinking 
about assembling similar Docker images for Koha, but haven't had the time, so 
hurray for you doing it!

I couldn't get your first URL to work as I think that's an authorised user 
link. Is it safe to say that this is the public link? 
https://hub.docker.com/r/julianmaurice/koha

Did you try the "debian:buster-slim" image? I keep meaning to look to see what 
makes these Koha images so large. With an interpreted language like Perl and 
Koha's immense functionality, I think it would be challenging to get a small 
image size. RedHat's registry.access.redhat.com/ubi8/perl-526 image is 658MB 
and that's without anything application specific even installed.

That being said, I think I see some places where you could improve your 
Dockerfile. Have you checked out multi-stage builds at 
https://docs.docker.com/develop/develop-images/multistage-build/? In your final 
image, you shouldn't need packages like gcc, git, *-dev, make, cpanm, etc. You 
can install those in a "builder" image and do the Koha build there. Then you 
can copy your Perl libraries and built Koha into the final image. That should 
also help you cut down on the number of layers you have. 

Nice work identifying those system perl dependencies. I keep thinking how we 
should minimize those. It should be reasonably easy to fix those. 

Actually, if Koha and its Perl dependencies are localized, you could override 
those with a mounted volume... which makes me wonder why you couldn't use a 
more minimal Linux...

I've actually been meaning to make some OpenSUSE Koha images which would help 
test out the concept of a minimal Koha running on something other than Debian 
as well, although one may as well use Debian, since that's the supported OS for 
Koha...

David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia

Office: 02 9212 0899
Direct: 02 8005 0595

-----Original Message-----
From: Koha-devel <koha-devel-boun...@lists.koha-community.org> On Behalf Of 
Julian Maurice
Sent: Tuesday, 18 February 2020 4:59 AM
To: koha-devel <koha-devel@lists.koha-community.org>
Subject: [Koha-devel] Minimal docker images for Koha

Hi all,

I've been playing with docker lately, and I tried to build a minimal docker 
image for Koha. Here are the results.

My goals were:
* Install only required "things" to get Koha up and running, and nothing else 
(no testing or dev tools),
* No external dependencies except CPAN
* Follow Docker best practices as much as possible

The resulting images are here:
   https://hub.docker.com/repository/docker/julianmaurice/koha

and the Dockerfiles are here:
   https://github.com/jajm/koha-docker

A few things worth mentioning:

* I tried to build the smallest image possible by using alpine or perl slim 
images at first but it was not that great, because the perl version shipped 
with those images is missing some libs, which cause MARC::Charset to build a 
database of several hundreds MBs (which is only 5MBs with a standard perl 
version). So I chose a more standard image
(debian:buster) as base.

* Koha doesn't work well when running with a perl version different than the 
system perl installed in /usr/bin/perl. For example, the updatedatabase doesn't 
work when called from the web installer. This is because Perl scripts are 
called directly as executable files, and shebangs contain '/usr/bin/perl'. Same 
problem from misc/translator/translate which calls tmpl_process3.pl.

* I tried to make the Koha installation as self-contained as possible. 
Almost everything is installed as a non-root user in /home/koha, including Perl 
dependencies.

* It doesn't need a reverse proxy such as apache or nginx. The necessary URL 
rewriting is handled in PSGI file. The container expose two ports, one for 
intranet, the other one for OPAC.

* Each Perl dependency is installed in its latest version, so expect things to 
break. I can only confirm that the webinstaller, basic cataloguing and 
search/indexation work. I did not test anything else.

* There are docker-compose.yml files in the github repository to get Koha 
running quickly with mariadb, memcached and elasticsearch.

* Zebra is not installed

* Images weigh ~1.15GB uncompressed (koha sources included)

If you made it this far, thanks for reading :) And if you want to use these 
docker images, you should start by reading 
https://github.com/jajm/koha-docker/blob/master/README.md

--
Julian Maurice
BibLibre
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/ git : http://git.koha-community.org/ 
bugs : http://bugs.koha-community.org/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to