GithubHelp home page GithubHelp logo

hello-akka-http-docker's Introduction

hello-akka-http-docker

Minimal project showing how to build and run a Dockerized akka-http server.

Note: in the examples below, the ports 9999 and 8888 can be replaced with any appropriate port, but the hostnames (localhost when running locally, 0.0.0.0 when running within a Docker container) should not be changed.

build and run using sbt

build

Run the assembly command in the sbt shell

sbt> assembly

This uses the sbt-assembly plugin added to project/target/plugins.sbt.

The artifact produced by this command will be found at

target/scala-2.13/out.jar

The name ("out.jar") is set in the build.sbt file.

run

You must provide a host (aka. interface) and port to run the server.

From within the sbt shell, run

sbt> run localhost 9999

You can then curl the server from a terminal

$ curl localhost:9999/hello
<h1>Bonjour!</h1>

You can also run the jar outside the sbt shell with

$ java -jar target/scala-2.13/out.jar localhost 9999

build and run using docker

build

Build and tag the Docker image with

$ docker build -t akka-http-docker:my-tag .

run

Then, run with

$ docker run -dit -p 9999:8888 akka-http-docker:my-tag 0.0.0.0 8888

Communicate with the container using the same command (and host, localhost) as above

$ curl localhost:9999/hello
<h1>Bonjour!</h1>

Note that we docker run using 0.0.0.0, but we curl using localhost

hello-akka-http-docker's People

Contributors

awwsmm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.