This basic HTTP server written in ZIO and ZIO-http provides a simple "Hello World" in response to a GET in the "/" route.
The idea is to demonstrate how to build a Docker container with the application binary built by GraalVM Native Image and packed into a container image ready for cloud distribution.
To simply run the application locally, use ./mill hello.run
. To run the tests, use ./mill hello.test
.
To build the Docker image (requires GraalVM JDK and Docker installed and running) with the binary, use:
./mill hello.dockerNative.build
The image docker.io/myuser/helloapp
will be created which can be started with:
docker run -it --rm -p 8080:8080 docker.io/myuser/helloapp
and browsed with:
❯ curl -s http://localhost:8080
Hello World!%
Push the image to a container registry like DockerHub (must be authenticated previously with docker login
) making it available globally:
./mill hello.dockerNative.push