diff --git a/Dockerfile b/Dockerfile index 6d0d695..1340fbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,14 @@ -FROM amazoncorretto:11.0.17 -LABEL version=5.8.0 description="EPAM Report portal. Complex migrations service" maintainer="Ivan Kustau , Hleb Kanonik " +FROM gradle:6.3-jdk11 AS build +ARG APP_VERSION +WORKDIR /usr/app +COPY . /usr/app +RUN gradle build --exclude-task test -Dorg.gradle.project.version=${APP_VERSION}; + +# For ARM build use flag: `--platform linux/arm64` +FROM --platform=$BUILDPLATFORM amazoncorretto:11.0.17 +LABEL version=${APP_VERSION} description="EPAM Report portal. Complex migrations service" maintainer="Ivan Kustau , Hleb Kanonik " +ARG APP_VERSION=${APP_VERSION} +ENV APP_DIR=/usr/app JAVA_OPTS="-Xmx1g -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -Djava.security.egd=file:/dev/./urandom" # Install MinIO Client (mc) RUN yum install -y curl && \ @@ -7,11 +16,8 @@ RUN yum install -y curl && \ -o /usr/local/bin/mc && \ chmod +x /usr/local/bin/mc -COPY ./complex-migrations-*-exec.jar complex-migrations-5.8.0-exec.jar -RUN echo 'exec java ${JAVA_OPTS} -jar complex-migrations-5.8.0-exec.jar' > /start.sh && chmod +x /start.sh - -ENV JAVA_OPTS="-Xmx1g -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -Djava.security.egd=file:/dev/./urandom" +WORKDIR $APP_DIR +COPY --from=build $APP_DIR/build/libs/complex-migrations-*exec.jar . VOLUME ["/tmp"] EXPOSE 8080 - -ENTRYPOINT ./start.sh \ No newline at end of file +ENTRYPOINT exec java ${JAVA_OPTS} -jar ${APP_DIR}/complex-migrations-*exec.jar \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4ed2d53..8bc6b3a 100644 --- a/build.gradle +++ b/build.gradle @@ -49,27 +49,16 @@ ext['log4j-to-slf4j.version'] = '2.17.0' // dependencies { - if (releaseMode) { - implementation 'com.github.reportportal:commons-events:f130879' - } else { - implementation 'com.github.reportportal:commons-events:f130879' - } implementation group: 'org.json', name: 'json', version: '20220320' - implementation 'net.javacrumbs.shedlock:shedlock-spring:4.21.0' - implementation 'net.javacrumbs.shedlock:shedlock-provider-jdbc-template:4.21.0' - // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' - implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-amqp' implementation 'org.springframework.boot:spring-boot-starter-aop' - implementation 'org.aspectj:aspectjweaver:1.9.7' implementation 'com.amazonaws:aws-java-sdk-s3:1.12.456' implementation 'software.amazon.awssdk:s3-transfer-manager:2.20.57' @@ -77,19 +66,8 @@ dependencies { implementation 'com.google.guava:guava:31.1-jre' - implementation 'org.json:json:20230227' - - - compile "com.rabbitmq:http-client:2.1.0.RELEASE" - runtimeOnly 'org.postgresql:postgresql' - testCompile 'org.junit.jupiter:junit-jupiter:5.5.2' - testCompile 'org.junit.jupiter:junit-jupiter-api:5.5.2' - testCompile 'org.junit.jupiter:junit-jupiter-params:5.5.2' - testCompile 'org.junit.jupiter:junit-jupiter-engine:5.5.2' - testCompile 'org.mockito:mockito-junit-jupiter:3.1.0' - } test { diff --git a/docker/Dockerfile-release b/docker/Dockerfile-release deleted file mode 100644 index 0119040..0000000 --- a/docker/Dockerfile-release +++ /dev/null @@ -1,26 +0,0 @@ -FROM openjdk:11-jre-slim - -LABEL version="@version@" -LABEL description="@description@" -LABEL maintainer="Andrei Varabyeu " - -ENV APP_FILE=@name@-@version@-exec.jar -ENV APP_DOWNLOAD_URL=https://dl.bintray.com/epam/reportportal/com/epam/reportportal/@name@/@version@/${APP_FILE} - -RUN apt-get update && \ - apt-get install wget unzip openssl -y && \ - # Create start.sh script - echo '#!/bin/sh \n exec java ${JAVA_OPTS} -jar ${APP_FILE}' > /start.sh && \ - chmod +x /start.sh && \ - # Download application - wget -O /${APP_FILE} ${APP_DOWNLOAD_URL} && \ - # Remove JOBS cache - rm -rf /var/lib/apt/lists/* - -# Set default JAVA_OPTS -ENV JAVA_OPTS="-Xmx512m -Djava.security.egd=file:/dev/./urandom" - -VOLUME ["/tmp"] - -EXPOSE 8080 -ENTRYPOINT ["/start.sh"]