OlegKunitsyn / gnucobol-docker

GnuCOBOL Docker image
GNU Lesser General Public License v3.0
5 stars 0 forks source link

make images smaller #3

Open GitMensch opened 3 years ago

GitMensch commented 3 years ago

Using alpine for a lightweight container is a very good idea.

With all the dependencies one of its size benefits (not using glibc) likely can be ignored, but if none of the dependencies would need glibc dropping it (by compiling the dependencies from source) would free up 3-4 MB ().

One part I think should make the containers smaller is to have all build-only dependencies handles as currently make is - only install "temporary" until GnuCOBOL is installed.

Note: you may want to drop the included cJSON and instead use the packages; json-c orcjson with its (-dev counterparts when building GnuCOBOL) - this would provide an "external maintained" (by alpine package maintainers) up-to-date-possibly-patched version; possibly with a (minimal) bigger size though.

To get the smallest size most dependencies would have to be compiled from source and any unused components be deactivated (for example it likely would be possible to deactivate many GCC parts, leaving only C and C++).

Speaking of the C compiler: if TCC would work "good enough" it would be reasonable to configure GnuCOBOL using this one for a container that is intended to compile fast (for a container that is intended to run the generated modules fast GCC is the much better option) - but this would also remove the coverage option (but decrease the container 85MB+).

OlegKunitsyn commented 3 years ago

I believe that open-source vendors nowadays need official repos at DockerHub like https://hub.docker.com/_/nginx. My expertise in C is somewhat limited.