In order to create your microservice project you need to have Maven and JDK installed on your developer machine. Then once you get the executable jar of the MSF4J project you can run this in any of the Docker hosting machines. For the hosting environment, you only need to have Docker installed on the hosting machine.
- Follow the instructions in WSO2 MSF4J readme and create your microservice project. Then generate the executable jar file.
- Copy this jar file into your hosting machine.
- Install Docker in your hosting machine.
- I'm using a Linux (Ubuntu) environment for this example.
- https://askubuntu.com/questions/938700/how-do-i-install-docker-on-ubuntu-16-04-lts
- Now create a Dockerfile next to your jar file.
- Enter the following lines into your Dockerfile.
- This will grab an existing docker image which will create the JDK runtime environment to run the jar file.
- Then the script copies the jar file into /tmp directory.
- Next, it exposes port 8080 to run the service.
- Finally, it runs the jar file
- Execute the following commands in terminal to run the Dockerfile.
- Now go to your web browser and access the service via port 8080.
Happy coding!!