Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 1.33 KB

File metadata and controls

56 lines (43 loc) · 1.33 KB

Faulty Service - JIT and Native Java Build & Deployment to Cloud Run

Build

Create a Spring Boot Application

# clone the repo
git clone https://github.com/GoogleCloudPlatform/serverless-production-readiness-java-gcp.git
cd services/quotes

Validate that you have Java 21 and Maven installed

java -version

Validate that GraalVM for Java is installed if building native images

java -version

# should indicate this or later version
java version "21" 2023-09-19
Java(TM) SE Runtime Environment Oracle GraalVM 21+35.1 (build 21+35-jvmci-23.1-b15)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)

Validate that the starter app is good to go

./mvnw package spring-boot:run

From a terminal window, test the app

curl localhost:8087

Build a JVM and Native Java application image

./mvnw clean package 

./mvnw native:compile -Pnative

Build a JIT and Native Java Docker Image with Buildpacks

./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=faulty

./mvnw spring-boot:build-image  -DskipTests -Pnative -Dspring-boot.build-image.imageName=faulty-native

Test the locally built images on the local machine

docker run --rm -p 8080:8087 faulty

docker run --rm -p 8080:8087 faulty-native