How do -dev apk packages differ on Alpine for the purposes of creating docker images? I recently started a new position at a company that is transitioning over to docker for local and prod, and inherited a few 'base image' repositories for php, node and a few others.

Unfortunately the creator is no longer at the company, so I'm going through the system and trying to piece it together. None of the images are used in production yet, and it's fair to say they are probably not road ready yet.

The images are based off alpine and I noticed particularly in the php image that most of the apk dependencies are using -dev distros:

apk add --no-cache $PHPIZE_DEPS bzip2-dev freetype-dev gmp-dev icu-dev ...


I couldn't easily find out the difference between, for example, bzip2 and bzip2-dev but my assumption would be that these packages are aimed at people who develop those packages. Next best guess would be they have some advantage for general developers (php in this example) but if so I'm not sure what those benefits would be.

What is the purpose of the -dev packages, and perhaps some guidance on where they would be appropriate (e.g. local only or fine for prod?)
dev packages are typically intended for development and build purposes. They usually contain header files and other resources for providing programmer APIs. For example, python-dev contains C headers for C/C++ applications that integrate python functionalities (which of course isn't necessarily python itself).

The "non-dev" packages provide the actual application or library: for example, python provides the python interpreter binary, the libpython3.so shared library, and compiled python modules.

For inspecting the contents of specific packages, you could use Alpine's excellent package explorer: locate the package of interest (for example, python3-dev), and click the "Contents of package " link at the bottom, to see the complete list of files installed by the package.