Automated Build

By now we know how to build our application locally, now we will automate this process by publishing the code to GitHub, setting a CircleCI build/test job and Docker Hub automated build.

In your situation you might have to use different version control and build systems and for this reason I do not provide very detailed descriptions these particular three.


Publishing to GitHub is a rather straightforward process. This is how it was done for our application:

  • I created a repository on GitHub with file -, and copied repository URL to clipboard.
  • Then I opened "Git Repositories" view in Eclipse, clicked the icon "Clone a Git Repository...", and completed the clone wizard.
  • Then for each project in the workspace I right-clicked on it, selected Team > Share project, and added the project to the new Git repository.
  • Finally, I've marked target and bin folders as ignored, added other files to the list of staged changes, committed them and pushed to upstream.

Building on CircleCI and publishing to Docker Hub

I already had accounts on CircleCI and Docker Hub. To build our application I had to add circle.yml file to the root of the repository:

    version: openjdk8
    - docker

    - echo 'Skipping Dependency Check'

    - wget
    - cd && mvn package javadoc:aggregate

    - cd && mvn verify

    - java -jar winstone-0.9.10.jar --controlPort=8081:
        background: true
    - sleep 5
    - cd && mvn package
    - java -cp winstone-0.9.10.jar shutdown
    - docker build -t nasdanika/bank:$CIRCLE_BUILD_NUM

    branch: master
    - mv*.zip $CIRCLE_ARTIFACTS    
    - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
    - docker push nasdanika/bank:$CIRCLE_BUILD_NUM

You can see that build steps in the file mirror the manual build steps which we performed in previous sections.

A docker image published by the build process is available at Docker Hub Nasdanika Bank repository.

results matching ""

    No results matching ""