I am trying to set up a development environment for developing a game application in a docker container. I created an image with sbt installed. Then I map the project folder on my host to a container like that and launch the shell interactively:
docker run -v /Users/jorgen/dev/play-sbt-docker/app:/data/app -w /data/app -p 9999:9000 -i -t jorgenfb/sbt /bin/bash
Then I launch the playback application by running sbt ~run . The game server starts to just find, it even recompiles when I edit my files on the host:
[info] Compiling 1 Scala source to /data/app/target/scala-2.10/classes... [success] Compiled in 2s
The problem is that the changes are not displayed in the browser during the update. No caching since I disabled caching. If I run the application from my host, everything will be fine.
Edit: This is my Dockerfile used to create a container with sbt:
FROM dockerfile/java:oracle-java8 MAINTAINER JΓΈrgen Borgesen ENV SBT_VERSION 0.13.5 # Install sbt RUN cd /tmp && \ wget https://dl.bintray.com/sbt/native-packages/sbt/$SBT_VERSION/sbt-$SBT_VERSION.zip && \ unzip sbt-$SBT_VERSION.zip -d /usr/local && \ rm sbt-$SBT_VERSION.zip
I did some more research. Inside the docker container, I launch the playback application as follows:
[ root@aa1f2327d938 :/data/app ]$ /usr/local/sbt/bin/sbt [info] Loading project definition from /data/app/project [info] Set current project to my-first-app (in build file:/data/app/) [my-first-app] $ ~run
Page loading in my browser works fine. Then I change the index file to the host. This causes recompilation inside the container:
[info] Compiling 1 Scala source to /data/app/target/scala-2.10/classes... [success] Compiled in 1s
Updating my browser still shows the initial index file. Even if the changes were caused by the playback application in the container. I also checked the compiled files in target/scala-2.10/classes/views/html (on my host, since I am running the playback application in the container, and I'm not sure how to connect multiple terminals to it). Compiled files have changed.
The next thing I did was hit Ctrl-D. This should take my back to the sbt console according to the printed message above "(Server started, use Ctrl + D to stop and return to the console ...)". However, this leads to the following result:
[success] Total time: 455 s, completed Sep 25, 2014 7:40:35 AM 1. Waiting for source changes... (press enter to interrupt) --- (Running the application from SBT, auto-reloading is enabled) --- [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000 (Server started, use Ctrl+D to stop and go back to the console...) [info] play - Application started (Dev)
Now the changes that I made earlier are reflected in the browser after the update.