From d404e84a4f5c9360ca1088f3a71920a08dd715b9 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Wed, 5 Oct 2022 18:08:30 +0700 Subject: [PATCH] Add lite Dockerfile build scripts and upgraded deps --- api/build.gradle.kts | 4 ++-- build.gradle.kts | 2 +- lite.Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 lite.Dockerfile diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 6c3f3fc..b9c1456 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -8,8 +8,8 @@ plugins { kotlin("plugin.jpa") } -val kotlinVersion = "1.7.0" -val springBootVersion = "2.7.0" +val kotlinVersion = "1.7.20" +val springBootVersion = "2.7.4" // find the last commit fun getGitHashLastCommit(): String { diff --git a/build.gradle.kts b/build.gradle.kts index 999d5a4..6e6dda1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ allprojects { group = "com.cubetiqs" version = "0.0.1-SNAPSHOT" - val javaVersion = "11" + val javaVersion = "17" tasks.withType { sourceCompatibility = javaVersion diff --git a/lite.Dockerfile b/lite.Dockerfile new file mode 100644 index 0000000..9b8ca30 --- /dev/null +++ b/lite.Dockerfile @@ -0,0 +1,39 @@ +# Builder +FROM cubetiq/openjdk:11u-ubuntu as builder +LABEL maintainer="sombochea@cubetiqs.com" + +WORKDIR /app + +RUN apt-get update && apt-get install -y git + +COPY . . + +RUN sh gradlew clean bootJar +RUN rm -f build/libs/*-plain.jar + +# Build for container image +FROM bellsoft/liberica-openjre-alpine-musl +LABEL maintainer="sombochea@cubetiqs.com" + +# Setup timezone to Phnom Penh +RUN ln -sf /usr/share/zoneinfo/Asia/Phnom_Penh /etc/localtime +RUN echo "Asia/Phnom_Penh" > /etc/timezone + +# App root path +WORKDIR /opt/cubetiq + +# App volumn +VOLUME ["/opt/cubetiq", "/data"] + +# Api Module Build Directory +ARG API_BUILD_DIR=api/build + +# Copy the app bundle to the workdir +COPY --from=builder /app/${API_BUILD_DIR}/libs/api-0.0.1-SNAPSHOT.jar ./api.jar + +# App profile will run with +ENV PROFILE=dev +ENV APP_DATA_DIR=/data + +# Entrypoint to app +CMD ["java","-jar", "./api.jar"] \ No newline at end of file