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
- Host: GitHub
- URL: https://github.com/fancellu/sbt-docker-helloworld
- Owner: fancellu
- Created: 2017-04-12T12:34:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-02-28T23:04:51.000Z (over 4 years ago)
- Last Synced: 2025-04-03T16:52:12.731Z (about 1 year ago)
- Topics: akka-http, docker, docker-compose, microservices, mongodb, scala, scalatest
- Language: Scala
- Homepage:
- Size: 8.79 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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