From b9db5b3472d87d88735bdfaaacf52046d0875d50 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Wed, 1 Mar 2023 12:12:12 +0100 Subject: [PATCH] first commit --- .gitignore | 1 + Dockerfile | 34 ++++++++++++++++++++++++++++++++++ README.md | 30 +++++++++++++++++++----------- 3 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 Dockerfile diff --git a/.gitignore b/.gitignore index 5a03bc3..6523057 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ Thumbs.db build/ target/ out/ +bin/ .micronaut/ .idea *.iml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e57a50c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +### +### Stage 1 - Builder Container +### + +FROM eclipse-temurin:17-jdk as builder + +# Install build requirements +#RUN apk update && apk add --no-cache cargo + +# Copy our application sourcecode to the container +WORKDIR /tmp/java/ +COPY . /tmp/java/ + +# Build our application from the sourcecode +RUN ./gradlew clean build + + + +### +### Stage 1 - Runtime Container +### + +FROM eclipse-temurin:17-jre-ubi9-minimal as runtime + +# Install runtime requirements +#RUN apk update && apk add --no-cache libgcc + +# Copy our binary artifact from the previous building stage +COPY --from=builder /tmp/java/build/libs/hello-*-all.jar /opt/app/hello.jar + +# Instructions for running our application +USER nobody +WORKDIR /opt/app +CMD ["java", "-jar", "/opt/app/hello.jar"] diff --git a/README.md b/README.md index 2d8361a..31207b1 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,22 @@ -## Micronaut 3.8.6 Documentation +# Hello Micronaut -- [User Guide](https://docs.micronaut.io/3.8.6/guide/index.html) -- [API Reference](https://docs.micronaut.io/3.8.6/api/index.html) -- [Configuration Reference](https://docs.micronaut.io/3.8.6/guide/configurationreference.html) -- [Micronaut Guides](https://guides.micronaut.io/index.html) ---- - -- [Shadow Gradle Plugin](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow) -## Feature http-client documentation - -- [Micronaut HTTP Client documentation](https://docs.micronaut.io/latest/guide/index.html#httpClient) +Test micronaut web application. +## Usage + +### Build application container + +```shell +docker build -t hellomicronaut . + +docker run --name hello1 -p 8080:8080 hellomicronaut +``` + + +### Test with browser + +Connect to the container on the specified port: + + +