This is a development container I put together that will let me play around with Kotlin without littering down my computer.
And since I use multiple different computers, it'll let me get up and running with Kotlin faster.
Big thanks to Avdi at RubyTapas who made really good videos on how to setup your own working environment with Docker.
My Dockerfile is essentially the same as the user nishtahir, I only added one line that will symlink /usr/bin/bash
to /usr/local/bin/bash
.
There are two super small scripts, one for starting up the container and one for jumping into it.
$ ls ./bin
hop_in.sh
start_container.sh
Note: You may need to give execution access to the scripts. (chmod +x)
docker-compose up -d
docker-compose exec kotlin-devcontainer bash -l
To see that everything is working as expected, I added a must have "Hello World!"
project.
kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar
kotlin HelloWorld.jar
-
Compilation time is really slow for me, I wonder if it is due to the fact that I only ran this so far on my Mac, will try on Windows later where I think they have better performance with Docker.
-
real 3m27.948s user 0m13.446s sys 0m14.094s
-
-
The way this development container runs forever is a little dirty,
docker-compose
will run the commandtail -F anything
where tail will not stop executing even when end of a file. Since the fileanything
does not exist anyway, it will forever keep the container alive.