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 the CERT is the CA file location in your file system.