Description
GenRocket provides a Docker image you can download and use for a containerized environment. The Genrocket-provided Docker image has GenRocket Runtime installed. Click here to learn more about using the provided Docker image.
However, you can also create a custom Docker image with the help of the Docker template provided in this article. This is beneficial in cases where you want to launch a service with GenRocket Runtime inside, along with the other configuration files required to launch the service that you want to customize.
Once finished, you can click here for the steps needed to finish the Docker setup. Remember to install GenRocket Runtime as well!
Docker Template
A Docker file can be created with the following content:
FROM openjdk:8-slim WORKDIR /opt/Genrocket #ARG ORGANIZATION_ID #ARG GR_RUNTIME_VRSION=3.5.27 RUN mkdir -p /opt/Genrocket; \ cd /opt/Genrocket; \ export GEN_ROCKET_HOME=/opt/Genrocket/genrocket; \ export PATH="${GEN_ROCKET_HOME}/bin:${PATH}"; \ apt-get update; apt-get install -y wget curl unzip libfontconfig1; \ rm -rf /var/lib/apt/lists/*; \ wget https://app.genrocket.com/rest/download/runtime/<orgExternalID> -O /opt/genrocket.zip ENV GEN_ROCKET_HOME=/opt/Genrocket/genrocket ENV PATH="/opt/Genrocket/genrocket/bin:${PATH}" COPY docker-entrypoint /opt/ RUN chmod 755 /opt/docker-entrypoint ENTRYPOINT ["/opt/docker-entrypoint"] CMD ["bash"]
The <orgExternalID> can be obtained from the My Organization page in the GenRocket web platform.
docker-entrypoint file
The above script is dependent on the docker-entrypoint file. The content of the docker-entrypoint file is shown below:
#!/bin/bash export GEN_ROCKET_HOME="/opt/Genrocket/genrocket" if [[ ! -d "$GEN_ROCKET_HOME" ]]; then echo "GenRocket HOME directory does not exist in the mounted HostSystemPath" cd /opt/Genrocket unzip /opt/genrocket.zip -d /opt/Genrocket for gr in $(ls -d */); do mv ${gr%%/} genrocket; done rm -rf genrocket.zip mkdir -p /opt/Genrocket/scenarios mkdir -p /opt/Genrocket/outputs else echo "GenRocket HOME directory already exists" fi if [[ "$GR_UPDATE" == "true" ]]; then echo "Updating the genRocket runtime environment using genrocket -a command" genrocket -a fi exec $@