2018-03-26 [technical] using Docker to do clean development on a mac

Here is how to clone a git repository, run Gradle on the code without installing git or Gradle on your mac. I’ll be using Docker (already installed on my computer)

Creating the dev folder

mkdir ~/dev
cd ~/dev>
mkdir gdax-java-gradle-home

Running git without installing git

docker run --rm -v $(pwd):/git -w /git alpine/git clone https://github.com/irufus/gdax-java.git
cd gdax-java
#edit the source file if needed

Compile, and test (or any Gradle task)

docker run --rm -v "$PWD":/gdax-java -v ~/dev/gdax-java-gradle-home:/gradle_home -w /gdax-java gradle gradle -g /gradle_home test
 I use the folder ~/dev/gdax-java-gradle-home keep the cache of Gradle persistent. By doing this Gradle will find most of the needed file cached and future executions will go faster.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.