Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Revert "Revert "Use native image for the backend""
Browse files Browse the repository at this point in the history
This reverts commit 05191a4.
  • Loading branch information
plamentotev committed Nov 19, 2023
1 parent 05191a4 commit 073bdef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM eclipse-temurin:17-jdk AS builder
#TODO Find a better way to build the native image
FROM ubuntu:22.04 AS builder
ADD ./gradle gradle
ADD ./src src
ADD ./gradlew gradlew
ADD ./build.gradle.kts build.gradle.kts
ADD ./settings.gradle.kts settings.gradle.kts
RUN ./gradlew build
RUN apt update && apt -y install build-essential libz-dev zlib1g-dev wget
RUN wget -q https://download.oracle.com/graalvm/17/latest/graalvm-jdk-17_linux-x64_bin.tar.gz
RUN tar xf graalvm-jdk-17_linux-x64_bin.tar.gz
RUN export JAVA_HOME=/graalvm-jdk-17.0.9+11.1/;./gradlew nativeCompile

FROM eclipse-temurin:17-jdk
COPY --from=builder build/libs/carboncritters-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
FROM ubuntu:22.04
COPY --from=builder build/native/nativeCompile/carboncritters carboncritters
ENTRYPOINT ["./carboncritters"]
3 changes: 2 additions & 1 deletion backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
java
id("org.springframework.boot") version "3.1.5"
id("io.spring.dependency-management") version "1.1.3"
id("org.graalvm.buildtools.native") version "0.9.28"
}

group = "mosquitobytes"
Expand All @@ -16,7 +17,7 @@ repositories {
}

dependencies {
implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.8.0"))
implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.8.4"))

// implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
Expand Down

0 comments on commit 073bdef

Please sign in to comment.