diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ee20a2d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM eclipse-temurin:17 as app-build +ENV RELEASE=17 + +WORKDIR /opt/build +COPY ./target/chatgpt-assistant.jar ./application.jar + +RUN java -Djarmode=layertools -jar application.jar extract +RUN $JAVA_HOME/bin/jlink \ + --add-modules `jdeps --ignore-missing-deps -q -recursive --multi-release ${RELEASE} --print-module-deps -cp 'dependencies/BOOT-INF/lib/*' application.jar`,jdk.crypto.cryptoki \ + --strip-java-debug-attributes \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output jdk + +FROM debian:buster-slim + +ARG BUILD_PATH=/opt/build +ENV JAVA_HOME=/opt/jdk +ENV PATH "${JAVA_HOME}/bin:${PATH}" + +RUN apt update && groupadd --gid 1000 spring-app \ + && useradd --uid 1000 --gid spring-app --shell /bin/bash --create-home spring-app + +USER spring-app:spring-app +WORKDIR /opt/workspace + +COPY --from=app-build $BUILD_PATH/jdk $JAVA_HOME +COPY --from=app-build $BUILD_PATH/spring-boot-loader/ ./ +COPY --from=app-build $BUILD_PATH/dependencies/ ./ +COPY --from=app-build $BUILD_PATH/application/ ./ + +ENTRYPOINT ["java", "-Dfile.encoding=UTF8", "-Dconsole.encoding=UTF8", "org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/Dockerfile-develop b/Dockerfile-develop new file mode 100644 index 0000000..b3a5ae9 --- /dev/null +++ b/Dockerfile-develop @@ -0,0 +1,34 @@ +FROM eclipse-temurin:17 as app-build +ENV RELEASE=17 + +WORKDIR /opt/build +COPY ./target/chatgpt-assistant.jar ./application.jar + +RUN java -Djarmode=layertools -jar application.jar extract +RUN $JAVA_HOME/bin/jlink \ + --add-modules `jdeps --ignore-missing-deps -q -recursive --multi-release ${RELEASE} --print-module-deps -cp 'dependencies/BOOT-INF/lib/*':'snapshot-dependencies/BOOT-INF/lib/*' application.jar`,jdk.crypto.cryptoki \ + --strip-java-debug-attributes \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output jdk + +FROM debian:buster-slim + +ARG BUILD_PATH=/opt/build +ENV JAVA_HOME=/opt/jdk +ENV PATH "${JAVA_HOME}/bin:${PATH}" + +RUN apt update && groupadd --gid 1000 spring-app \ + && useradd --uid 1000 --gid spring-app --shell /bin/bash --create-home spring-app + +USER spring-app:spring-app +WORKDIR /opt/workspace + +COPY --from=app-build $BUILD_PATH/jdk $JAVA_HOME +COPY --from=app-build $BUILD_PATH/spring-boot-loader/ ./ +COPY --from=app-build $BUILD_PATH/dependencies/ ./ +COPY --from=app-build $BUILD_PATH/snapshot-dependencies/ ./ +COPY --from=app-build $BUILD_PATH/application/ ./ + +ENTRYPOINT ["java", "-Dfile.encoding=UTF8", "-Dconsole.encoding=UTF8", "org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/pom.xml b/pom.xml index dd679e5..fda3b9f 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,7 @@ org.springframework.boot spring-boot-maven-plugin + chatgpt-assistant org.projectlombok