Configuring the Engine Worker
Configure the Gradle property CPLEX_STUDIO_LINUX to a local archive file that contains the Linux CPLEX Studio files. It must match the CPLEX version configured for the engine library and the CPLEX Studio files must be in the /cplex_studio folder of the archive. For more details, please refer to Section Using Gradle Configuration Files.
In the file workers/engine-worker/build.gradle, uncomment the lines that mention linux/amd64 and local-cplex-worker.gradle.
Note that the linux/amd64 is enforced because there is no CPLEX binaries for Linux/arm64 available.
In the file workers/engine-worker/Dockerfile, add the following lines right after the FROM instruction. If you have more than one build stage, place this in the last build stage of your Dockerfile.
# Copy CPLEX Studio files
ARG CPLEX_STUDIO_FILES
ARG STUDIO_HOME=/usr/local/cplexstudio
COPY --link --chmod=755 $CPLEX_STUDIO_FILES $STUDIO_HOME
# Setup the environment variables so that the libraries are found when running
ENV CPLEX_OPL_BIN="${STUDIO_HOME}/cpoptimizer/bin/x86-64_linux:${STUDIO_HOME}/cplex/bin/x86-64_linux"
ENV PATH="${CPLEX_OPL_BIN}:${PATH}"
ENV LD_LIBRARY_PATH="${CPLEX_OPL_BIN}:${LD_LIBRARY_PATH}"
These code changes will make your Java code use the libraries from your CPLEX Studio home when running on your machine and use the libraries from the Linux CPLEX Studio files when running inside the Docker container.You can now run the worker in development mode or within the Docker image after building it, with the following command:
./gradlew :workers:engine-worker:docker