Book a demo

← Documentation

How to Dockerize the OpenLegacy API

Each generated API contains a default docker file. In case you would like to build a docker image based on it, you will need to follow the next steps:

# Option 1.
# Build the API with Gradle 
gradle build

# Option 2.
# Build the API with Maven 
# Building the API project into the .m2 and the target directory
mvn clean install -DskipTests
# Building the API project in the target directory
mvn clean package -DskipTests

# Create the docker image
# In the OpenLegacy Project Root directory 
docker build -t <YOUR REGISTRY NAME>/<API NAME>:<VERSION> .

Running the above will create the image for the API.

In case you also need to add a self-signed CA to the JVM, you should modify the dockerfile and add these commands:

ARG CERT='ca-root.cer'
COPY $CERT /
RUN keytool -importcert -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit -noprompt -trustcacerts -file $CERT -alias $CERT

Where CERT is the CA certificate file name. changeit is the JDK's default truststore password; if your base image uses a different truststore password, use that one, and change the default password in production images. COPY can only read files inside the Docker build context, so first copy the CA file into the project root directory (the build context).

changeit is the JDK's default truststore password. If your truststore uses a different password, use it instead. For production images, change the default truststore password (for example, with keytool -storepasswd) and pass the new password in this command.

Read more

Tell us about yourself

You've been browsing the catalog. Leave your details to keep exploring.

Privacy policy