Skip to content

Deployment

Saulo Aguiar edited this page Jul 4, 2017 · 5 revisions

Goal: Circle CI to build a docker container from a uberJar generated with gradle.

The task is being approach in these steps:

  • Gradle task to create uberjar
  • Build the docker container
    • Created the Dockerfile
    • Followed sample from postgres
    • Spantree blog post on docker and tips to create a dockerfile.
    • Docker Compose in 12 minutes
    • Docker Getting Started and Docker-Compose getting started sections were fundamental to get a better grasp of the overall procedure.
    • This spring-boot-docker-mysql repo was a good source of knowledge for the whole task.
    • We start both containers (postgres and application) using docker run command.
      • For postgres we have: docker run --name database -p 8000:5432 -d postgres
      • For the application, we need to build the container: docker build -t application . and the start it: docker run -p 8080:8080 --link postgres:postgres -v ~/projects/demo:/usr/local/application-data -v ~/.gradle/:/root/.gradle/ application
    • The values in the application.properties file were updated to reflect the link address made available by the --link option in the docker run command
  • Shell script
    • Calls the gradle tool inside the container to build the application from kotlin source
    • Executes the application
Clone this wiki locally