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.
The list of entries that seem to match that description (only runtime part needed db needed after GC install):
db-dev
ncurses-dev
libxml2-dev
gettext-dev - if the translation of compiler and runtime messages is not relevant for the container: drop that completely
Possible to remove manually with rm:
gmpxx-parts (gmp-dev itself is also needed after GnuCOBOL install)
possibly either not needed at all or at least not after GnuCOBOL was installed:
file
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+).
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.
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.db
needed after GC install):rm
: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+).