From fd8942b3b78441d1712c3729fd2c54ee01384aad Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Thu, 21 Apr 2022 17:53:00 +0700 Subject: [PATCH] Updated Dockerfile --- Dockerfile | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 58689d8..2845830 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,38 @@ -FROM cubetiq/calpine-openjdk11:latest +# Builder +FROM cubetiq/openjdk:11u-ubuntu as builder LABEL maintainer="sombochea@cubetiqs.com" -# Working directory for application +WORKDIR /app + +RUN apt-get update && apt-get install -y git + +COPY . . + +RUN sh gradlew clean bootJar + +# Build for container image +FROM cubetiq/openjdk:jre-11u-debian +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 -# Define mount volumn for data path -VOLUME ["/opt/cubetiq/data"] +# App volumn +VOLUME ["/opt/cubetiq", "/data"] -# Copy build source to container -COPY api/build/libs/*.jar ./api.jar +# Clinic Api Module Build Directory +ARG CLINIC_API_BUILD_DIR=api/build -ENV APP_DATA_DIR "/opt/cubetiq/data" +# Copy the app bundle to the workdir +COPY --from=builder /app/${CLINIC_API_BUILD_DIR}/libs/*.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