azavea / usace-program-analysis-geoprocessing

Companion geoprocessing repository of https://github.com/azavea/usace-program-analysis
Apache License 2.0
1 stars 1 forks source link

Dockerize and publish to Quay #1

Closed rajadain closed 8 years ago

rajadain commented 8 years ago

Overview

Instead of building a JAR which gets included in a Docker image by the client repository, we publish a Docker image on Quay which can immediately be included by the client.

This branch is a cleaned up version of work done in feature/hmc/docker.

Testing Instructions

Test Docker by running

$ ./sbt "project geop" assembly
$ docker build -t usace-geop-test .
$ docker run --rm --publish 127.0.0.1:8090:8090 usace-geop-test
$ curl http://localhost:8090
OK

Not sure what the best way is to test Travis, but one way is to see success in the final build of the source branch, and the diff between this work and the source branch:

diff --git a/.gitignore b/.gitignore
index 6d907a5..c3b4ce1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,3 @@ project/plugins/project/
 .scala_dependencies
 .worksheet
 .idea
-
-# CI Specific
-docker/*.jar
diff --git a/.travis.yml b/.travis.yml
index b61fdca..35e561b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,12 +29,14 @@ deploy:
     on:
       repo: azavea/usace-program-analysis-geoprocessing
       tags: true
+
   - provider: script
     script: "scripts/cibuild.sh"
     skip_cleanup: true
     on:
       repo: azavea/usace-program-analysis-geoprocessing
-      branch: feature/hmc/docker
+      branch: develop
+
   - provider: script
     script: "scripts/cibuild.sh"
     skip_cleanup: true
diff --git a/README.md b/README.md
index 207dcd4..a1a1fd8 100644
--- a/README.md
+++ b/README.md
@@ -49,12 +49,13 @@ To test with the [main web app](https://github.com/azavea/usace-program-analysis

 ## Deploy

-Deployments to GitHub Releases are handled via [Travis-CI](https://travis-ci.org/azavea/usace-program-analysis-geoprocessing). The following `git-flow` commands signal to Travis that we want to create a release. The `version` variable should be updated in `project/Version.scala.`
+Deployments to [GitHub Releases](https://github.com/azavea/usace-program-analysis-geoprocessing/releases) and [Quay](https://quay.io/repository/usace/program-analysis-geoprocessing) are handled via [Travis-CI](https://travis-ci.org/azavea/usace-program-analysis-geoprocessing). The following `git-flow` commands signal to Travis that we want to create a release. The `version` variable should be updated in `project/Version.scala` and `Dockerfile`.

 ``` bash
 $ git flow release start 0.0.1
 $ vim CHANGELOG.md
 $ vim project/Version.scala
+$ vim Dockerfile
 $ git commit -m "0.0.1"
 $ git flow release publish 0.0.1
 $ git flow release finish 0.0.1

Connects https://github.com/azavea/usace-program-analysis/issues/5

hectcastro commented 8 years ago

It looks like this may actually be valid .dockerignore syntax. Adding this to the directory that contains the Dockerfile should reduce the amount of local data sent to the Docker daemon for the build context:

*
!geop/target/scala-2.10/*.jar
rajadain commented 8 years ago

That's a great find, I added it.

On Friday I tried moving the Dockerfile to a folder with nothing else, but found that too confusing and not in keeping with our convention of keeping the Dockerfile in the root. This is much nicer.

rajadain commented 8 years ago

I think the most recent commits should capture everything.

I looked into using program-analysis instead of programanalysis as the package name in Scala, so we can have consistency between the repo name usace-program-analysis-geoprocessing and the JAR file usace-programanalysis-geop but having hyphens there is generally frowned upon. Between having the JAR file match the repo name (run / build time) and the class name (design time), I preferred it matching the class name, since now with Docker the actual JAR file is pretty much abstracted away for run time, and build time values are probably not going to be touched very much after this.

hectcastro commented 8 years ago

👍 Nicely done.

rajadain commented 8 years ago

Thanks for pairing with me on this and teaching me about Docker and Quay!