Statically Compile Crystal Program and Distribute as docker Image
In this article we are sharing how to statically compile a crystal program and then share the executable inside a docker image. We will create the smallest docker image possible. Smaller images are easier to manage, distribute and boot.
Note: The way docker works, each command/line creates a layer (with context).
The good news about crystal lang is the they distribute the docker image with all the libraries so that we can build static compiled executable(s). Attaching the docker file I wrote to statically compile a crystal language program.
Note: The program uses the Kemal web framework, so this could also be considered an article on how to statically compile and distribute a kemal web app.