#Create Dockerfile for Ballerina REST API server which use Java interoperability.

1 messages ยท Page 1 of 1 (latest)

rare sand
#

Hi, I have a locally build Ballerina Rest API server which calls Java methods. I'm trying to create a docker container to host the server on Choreo. I'm not sure how to write the dockerfile since the Ballerina bindings to Java code needs two images; Ballerina and Maven. Could you please help me with this? The file structure and the commands to run the server are attached here.

This might not be directly related to this channel but thought of asking for help after many failed attempts. One of the failed dockerfile is also attached.

sinful panther
#

Is this code available in github by any chance?

rare sand
sinful panther
#

Why can't we deploy this as a normal ballerina service in ballerina? Is there any reason to go for the docker file based approach? I feel like you can run the bindgen commands, commit them, deploy and run normally?

#

If this approach doesn't' work, we should be able to manually use c2c to generate the dockerfile/image as well. But in choreo its done internally therefore using choreo's default ballerina approach is better.

rare sand
sinful panther
#

Alright, to use c2c[https://ballerina.io/learn/by-example/c2c-docker-deployment/]

You can find the following steps.
Add cloud="docker" into build-options of Ballerina.toml
Then execute bal build and then you should see the required jars and dockerfile in the target directory. .
You can use the above artifacts for choreo, dockerfile based approach ๐Ÿ™‚

We need to see how to handle configurables in Dockerfile approach. I'll look into this and let you know ๐Ÿ™‚

Edit - Seems like you can add the Config.toml as a filemount in choreo using devops portal.