Public | Automated Build

Last pushed: 9 months ago
Short Description
Image for running java spring boot based git projects.
Full Description


Image for running java spring boot based git projects.

Java projects

Should have and structure like the following:

               +-> ...
               +-> ${SRC_DIR} + 
                              + target/app-vxx.jar (file to be run)

Should expose an endpoint that will be the one that we expose in docker.

Check, is a Spring Boot app that
exposes the api in 8080 port.

You can configure the app through the "env" property in the json file, in this

PROJECT_DIR: where everything will be installed inside the container.
GIT_REPO: the repo to download.
SRC_DIR: the source folder inside the project.
APP_FILE: entry point to python application.
BUILD_SOURCES: compile app from sources and start or directly start (target/app-vxx.jar must exist).

sample mesos application json, let's say py-docker.json (see doc/mesos/)

          "id": "java-docker",
          "instances": 1,
          "cpus": 1,
          "mem": 1024,
          "constraints": [["hostname", "UNIQUE", ""]],
          "env": {
              "PROJECT_DIR": "/usr/local/javaenv",
              "GIT_REPO": "",
              "SRC_DIR": "complete",
              "APP_FILE": "target/gs-rest-service-0.1.0.jar",
              "BUILD_SOURCES": "false"
          "container": {
            "type": "DOCKER",
            "docker": {
              "image": "periket2000/java_docker:v1.0",
              "network": "BRIDGE",
              "portMappings": [
                  "containerPort": 8080,
                  "hostPort": 0,
                  "servicePort": 0,
                  "protocol": "tcp"
          "healthChecks": [
                "protocol": "HTTP",
                "portIndex": 0,
                "path": "/greeting",
                "gracePeriodSeconds": 5,
                "intervalSeconds": 20,
                "maxConsecutiveFailures": 3

Sample load on mesos

curl -X POST http://<marathon_host>:<marathon_port>/v2/apps -d @<file> -H "Content-type: application/json"
curl -X POST -d @app.json -H "Content-type: application/json"

How to run it in local (requires docker)

git clone
cd java_docker
docker build -t mytag .
docker run -p 9999:8080 mytag

and point your browser to "http://localhost:9999/greeting"

Docker Pull Command
Source Repository