From ed12bfd473d2e8e2cd6b2a3962048abe6ca91074 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Sun, 15 Jan 2023 19:14:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D1=83=20=D0=B4=D0=BB=D1=8F=20dev?= =?UTF-8?q?elop=20=D0=B2=D0=B5=D1=82=D0=BA=D0=B8.=20snapshot=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BF=D0=BE=D0=BF=D0=B0=D0=B4=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=B9=D0=BD=D0=B5?= =?UTF-8?q?=D1=80=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA?= =?UTF-8?q?=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 4 ++-- Dockerfile-develop | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 Dockerfile-develop diff --git a/.drone.yml b/.drone.yml index edd8920..9bc2bd9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -46,7 +46,7 @@ steps: commands: - echo "$DOCKER_REGISTRY_TOKEN" | docker login docker.io --username $DOCKER_REGISTRY_USER --password-stdin - docker buildx create --use - - docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:develop" . + - docker buildx build -f Dockerfile-develop --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:develop" . --- @@ -100,6 +100,6 @@ steps: - docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:latest" -t "$DOCKER_IMAGE_NAME:$DRONE_TAG" . --- kind: signature -hmac: 1bb00c9edf1c37a2f36c92ea6c1cb9023630b05550b4dc3148c6f5b30cad4af6 +hmac: 35a90784852fd87ed37036310873fb0c02457fb3dafd79cd2c1661b36b56117a ... diff --git a/Dockerfile-develop b/Dockerfile-develop new file mode 100644 index 0000000..f1faba1 --- /dev/null +++ b/Dockerfile-develop @@ -0,0 +1,34 @@ +FROM eclipse-temurin:17 as app-build +ENV RELEASE=17 + +WORKDIR /opt/build +COPY ./gitlab-app/target/gitlab-notification.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