Run DashO inside a Docker container to protect your Java and Android apps as part of a containerized build. PreEmptive doesn't provide pre-built DashO images, but you can build your own from the DashO distribution archive. This article walks you through creating the image and running DashO in a container.
Prerequisites
- A Floating License. DashO containers require a floating license.
- Docker installed on the machine where you build the image.
Build the DashO Image
Use the following sample Dockerfile as a starting point:
FROM adoptopenjdk:11.0.8_10-jdk-hotspot
ARG DASHO_BASE="/opt/PreEmptive_Protection_DashO_{x.y}"
ENV DASHO_HOME="${DASHO_BASE}/app"\
JDK_HOME="/opt/java/openjdk"
# Extract the installer
ADD PreEmptive_Protection_DashO_{x.y.z}.tar.gz $DASHO_BASE
# Link the extracted directory to the standard installation location.
RUN ln -s “$DASHO_BASE/PreEmptive Protection DashO {x.y}” “$DASHO_HOME”
# Set up to run the command line interface
ENTRYPOINT ["/opt/PreEmptive_Protection_DashO_{x.y}/app/dashocmd"]To build this image:
- Save the sample as a file named
Dockerfilein a directory of your choice. Replace {x.y[.z]} with the appropriate major.minor[.patch] version. - Download the
PreEmptive_Protection_DashO_{x.y.z}.tar.gzarchive from PreEmptive Downloads. - Place the archive in the same directory as your
Dockerfile. -
Run the following command, replacing
{path to Dockerfile directory}with the directory from step 1:docker build -t preemptive/dasho:{x.y.z} {path to Dockerfile directory}
Run the DashO Container
To run DashO, mount your project directory and pass your license to the container. Provide the license in one of the following ways.
Replace {x.y[.z]} with the appropriate major.minor[.patch] version.
Mirror the License from Your Environment
If DASHO_LICENSE is already set on the host, pass it through to the container:
docker run --rm -e DASHO_LICENSE -v {projectPath}:/code preemptive/dasho:{x.y.z} /code/project.doxIf you are running the container for Android, use the following command:
docker run --rm -e DASHO_LICENSE -v {projectPath}:/code -v {ANDROID_SDK_PATH}:{ANDROID_SDK_PATH} preemptive/dasho:{x.y.z} --pathMap {PATHMAP_PATH} --properties {PROPERTIES_PATH} /code/project.doxSet the License in the Container's Environment
docker run --rm -e DASHO_LICENSE={LicenseString} -v {projectPath}:/code preemptive/dasho:{x.y.z} /code/project.doxPass the License on the Command Line
docker run --rm -v {projectPath}:/code preemptive/dasho:{x.y.z} --license {LicenseString} /code/project.dox