Public | Automated Build

Last pushed: a year ago
Short Description
Simple Cloudant example build with Docker.
Full Description

Cloudant

Cloudant and Java application running in WebSphere build with Docker.

Prerequisites

CouchDB

Those steps must be followed to build and run a CouchDB Docker container.

Build

Create and build a CouchDB container:

docker build -t couchdb .

Run

Once the image is built, start it with:

docker run --name couchdb -p 5984:5984 -d couchdb

Application

Those steps must be followed to build and run the Java application Docker container.

Build

At root directory, run:

docker build -t filipecorrea/cloudant-java .

This will take a while for the first time since it downloads and installs Maven and downloads all the project’s dependencies. Every subsequent start of this build will only take a few seconds, as again everything will be already cached.

You might need to change Docker IP in src/main/java/com/cloudant/CloudantAPI.java so the application can find the CouchDB database:

databaseURL = "http://192.168.99.100:5984";

Run

Once the image is built, start it with:

docker run --name cloudant-java -d -p 80:9080 filipecorrea/cloudant-java

WebSphere takes about a minute to start. Once it's complete, you can test the application running:

open "http://$(docker-machine ip default)/Sample/SimpleServlet"

Optional

fswatch is a file change monitor that receives notifications when the contents of specified files or directories are modified.

If you want to keep your Docker container updated everytime you change project's source code, just install it using Homebrew:

brew install fswatch

And point it to your project source folder:

fswatch -o ~/project-path/src | xargs -n1 ~/project-path/build.sh
Docker Pull Command
Owner
filipecorrea
Source Repository

Comments (0)