System Dependencies

What if you have a third-party dependency installed at the system level? For instance, the pymssql package requires another package called freeTDS. If you needed pymssql as a dependency, you could put that in your requirements.txt file, but without freeTDS installed on your system, it would raise a runtime error when attempting installation.

We build Docker containers for your code for all of our deployments to the Q2 datacenter. Our Docker base image uses Debian Linux (Debian 9). The command to install freeTDS on Debian 9 is the following:

$ apt-get update && apt-get install -y freetds-dev

The Caliper SDK provides a convenient hook to notate this dependency alongside your code. When our docker containers are built, we look for a file called container-prebuild-hook.sh in the root of the repo, and if it exists, run it before installing the Python dependencies enumerated in requirements.txt.

In the above example, we can simply drop that apt-get line in a file called container-prebuild-hook.sh and voila, we can now build pymssql!