Public | Automated Build

Last pushed: 8 months ago
Short Description
This is a minimal docker container based on Ubuntu 14.04 for Play Framework development.
Full Description

docker-play

This is a minimal docker container based on Ubuntu 14.04 for Play Framework development.

Description

You should run this container interactivelly and launch activator console commands from within your play projects directories.

Includes:

  • Oracle JDK 1.8
  • Typesafe Activator 1.3.12 (Play 2.5.10)
  • Git, wget, curl, build-essential

Users

A user named play is created with sudoers privileges. Home is at /home/play.

Volumes

Exports a volume on /home/play/Code.
You can mount the volume on run to a local directory containing your code.

ivy2 and sbt caches

Java user.home variable is defined, pointing to /home/play/Code.
In this way, all dependencies are kept if you mount the /home/play/Code volume on /home/play/Code/.ivy2 and /home/play/Code/.sbt directories.

Ports

Three ports are exposed:

  • 9000: default Play port.
  • 9999: default Play debug port.
  • 8888: default Activator UI port.

Remember to map the ports to the docker host on run.

How to run the container

Using docker

You need docker v1.3+ installed. To get the container up and running and drop to an interactive shell, run:

sudo docker run --rm -it -v "/home/dordoka/Code:/home/play/Code" -p 9000:9000 -p 9999:9999 -p 8888:8888 dordoka/play-framework

Remember to change /home/dordoka/Code to the directory where your code is stored.

Using docker-compose

If you have docker-compose installed, you can just launch:

sudo docker-compose up

NOTE: compose doesn't support interactive shells directly. See Issue 423

Happy coding! :)

Docker Pull Command
Owner
dordoka
Source Repository

Comments (14)
dordoka
8 months ago

You might also wanna try to pass this flag to docker when starting the container to see if this fixes the uid issue. Please report back!

-u $(id -u)

dordoka
8 months ago

Upgraded to Activator 1.3.12 and Play 2.5.10.

Regarding the uid problems, I'll post here a link to the docker issue for reference. I will eventually modify the Dockerfile when I get some free time. PRs welcome! ;)

https://github.com/docker/docker/issues/7198

julienderay
a year ago

Each reload takes at least 20 seconds, is that normal ?

araknafobiatr
a year ago

Is there a solution for problem that @bachi mentioned?
I can not run sudo in that image.

dordoka
a year ago

Upgraded to Activator 1.3.9 and Java 1.8.0 77. Play 2.5!

dordoka
2 years ago

Updated version today: Activator 1.3.7 and Java 1.8.0_72. That means Play Framework has been upgraded to 2.4.6 as well.

dordoka
2 years ago

saha92, take a look at the bachi comment below, that might solve your issue.

saha92
2 years ago

Hello,

Everytime I do Activator Run in the docker container, I get an error: java.lang.RuntimeException: Could not create directory /home/play/Code/project/target/config-classes

How should I resolve?

dordoka
2 years ago

Thanks @bachi for your tip. I will take a look and see if I can improve the image.

bachi
2 years ago

Might be worth mentioning (although it seems a general docker issue): If you use Linux and run into not found IOExceptions when trying to run activator, it is likely that your local user has another uid than the one inside the container (which has 1000 as the first user), so the 'play' user doesn't have write perms in the mounted folder.