Alkemist by RunSafe

alkemist logo


center logo for this page's deployment type


shield with heart in the middle
You're only a few steps away from deploying Alkemist:Code into your Docker environment!
1 of 7
Down Arrow Mirrored

Select Docker Base OS

Alkemist:Code supports Alpine through Docker images. Select the version of Alpine you use and all instructions throughout the rest of the page will be tailored to that choice.

2 of 7
Down Arrow

Open Your Dockerfile

The steps that follow this one will all use this sample Dockerfile as their base. The second tab is the hello_world.c used by the COPY command on line 7.

3 of 7
Down Arrow Mirrored

Add Alkemist:Code Stage

The first modification to your Dockerfile will be to add Alkemist:Code''s Load-time Function Randomization (LFR) image as a stage before the stage doing the build. The Alkemist:Code image contains two ONBUILD commands which handle license verification and other pre-build steps.

4 of 7
Down Arrow

Copy Alkemist:Code Files

After pulling in the Alkemist:Code stage you will copy Alkemist:Code out of that stage and into yours. First, set the LFR_ROOT_PATH environment variable to a location in your image that will contain Alkemist:Code during the build. This location will be removed at the end so pick somewhere that does not contain anything else.

Next, copy the files that comprise Alkemist:Code from the Alkemist:Code stage and into yours with COPY --from=lfr-files /usr/src/lfr ${LFR_ROOT_PATH}.

5 of 7
Down Arrow Mirrored

Add and

Now that your Docker image contains the files necessary for Alkemist:Code to run, prepend your build commands (make, gcc, g++, etc) with to automatically integrate Alkemist:Code into your existing build process.

Also include a call to after your build is completed to make sure that files which were only needed by Alkemist:Code for the build are not included in your final image.

The command shown will build the given hello_world.c into an Alkemist:Code-protected program called hello_world, but you can add to any build command, simple or complex.

6 of 7
Down Arrow

Build Image with Alkemist:Code

Alkemist:Code expects your license key to be provided as an ALKEMIST_LICENSE_KEY build argument. The preferred way to do this is to specify your key as a build argument from the command line along with the current date, as shown.

The date is added in the Docker deployment method to avoid caching license information which will become stale in future builds. This will not invalidate the caching of your layers, only the final two ONBUILD commands within the Alkemist:Code image.

7 of 7
Alkemist Logo

Verify Alkemist:Code Protection

Each tab shows a different way to confirm that Alkemist:Code has been applied to a given binary. The examples are for the hello_world binary built in the previous step.