An open API service indexing awesome lists of open source software.

https://github.com/fancellu/sbt-docker-helloworld

Simple sbt-native-plugin docker hello world example plus docker-compose example
https://github.com/fancellu/sbt-docker-helloworld

akka-http docker docker-compose microservices mongodb scala scalatest

Last synced: 10 months ago
JSON representation

Simple sbt-native-plugin docker hello world example plus docker-compose example

Awesome Lists containing this project

README

          

sbt-docker-helloworld
=====================

This is a simple hello world example to serve as a skeleton app to show your Scala code
running inside a docker container

[A more complex docker-compose example](docker-compose/README.md)

It uses the ```sbt-native-packager``` plugin

First, make you you have docker installed and running

i.e. ```docker ps```

should return the running containers on your current docker host

Then go to the root of this project and run

```sbt stage docker:publishLocal```

It should build and end with

```
[info] Built image DockerAlias(None,None,sbt-docker-helloworld,Some(1.0))
[success] ...
```

```docker images```

should show your new image, named ```sbt-docker-helloworld```

To run

```docker run -it sbt-docker-helloworld:1.1```

You should see "Hello World" follow by the timestamp

Of course to run locally outside of docker, just run

```sbt run```

---

If you look inside ```target/docker``` you'll see the ```Dockerfile```, jars,
and ENTRYPOINT binaries

If you're curious you can shell into the image and take a look around

```docker run -it --entrypoint bash sbt-docker-helloworld:1.0```

e.g. ```bin/sbt-docker-helloworld``` will run the scala app

You can even supply your own Dockerfile if you so wish

http://sbt-native-packager.readthedocs.io/en/latest/formats/docker.html#custom-dockerfile

---

In order to make Docker easier to use, I recommend the portainer container, an admin web app for Docker
http://portainer.io

To read more about the sbt-native-packager Docker plugin

http://sbt-native-packager.readthedocs.io/en/latest/formats/docker.html

There is also another sbt-docker plugin

https://github.com/marcuslonnberg/sbt-docker