aleveille / quarkus-minimal-service

A minimal Java API service with Quarkus with native executable builds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quarkus minimal service example with GraalVM native binary build packaged into a Docker image

This is a minimal Java API service implemented by following the Quarkus getting started guide.

This repo aims to give a working example of building a minimal but working Java 11 API service that will be built into a native Linux binary using GraalVM. This binary is then packaged into a Docker image for ease of deployment and execution across platforms and cloud providers.

This repository, when it was originally bootstrapped from Maven, came with its own README file.

Tooling

Note that there's also a Dockerized build, which mean that you can build this repo without having to install anything if you're just looking to give Quarkus a trial run.

Building

Assuming you have everything installed and configured according to Quarkus and GraalVM instructions, you can build this project like this:

./mvnw package -Pnative -Dquarkus.native.container-build=true
docker build -f src/main/docker/Dockerfile.native -t quarkus-minimal-service .

If you do not wish to install these things, you can use a multistage Docker build as explained by Quarkus.

In short, you simply need to delete the .dockerignore file and then use the multi-stage build file of this repo:

rm .dockerignore
docker build -f src/main/docker/Dockerfile.multistage -t quarkus-minimal-service .

The build, regardless of the method, takes about 4 minutes on my Machine (MacBook Pro 2018, 2.3 GHz Quad-Core Intel Core i5).

You can then run docker run -i --rm -p 8080:8080 quarkus-minimal-service to start a Docker container running the native executable and point your browser to http://localhost:8080/greeting/yourname to test it out.

License

All the content in this repository that is my authorship (code that I wrote) is made freely available for anyone to use without any restriction. See the unlicense of this repository. However, all the trademarks, copyrights , logos and whatnot that I might have included, used or mentioned in this repository are the property of their respective owners.

About

A minimal Java API service with Quarkus with native executable builds

License:The Unlicense


Languages

Language:HTML 61.4%Language:Java 38.6%