From aba907144ef1d34b6b89b21b7d9ef5a76c91474a Mon Sep 17 00:00:00 2001 From: Maxim Kochetkov Date: Tue, 21 Apr 2020 16:07:57 +0300 Subject: [PATCH] add docker build action / fix bugs --- .github/workflows/release.yml | 9 ++++++++- Dockerfile | 10 ++++++++++ gradle.properties | 7 ++++++- src/main/java/ru/iopump/qa/allure/Application.java | 7 +++---- .../qa/allure/controller/AllureResultController.java | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45124dc..e4fc722 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,4 +51,11 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: build/libs/allure-server-${{ env.RELEASE_VERSION }}.jar asset_name: allure-server.jar - asset_content_type: application/jar \ No newline at end of file + asset_content_type: application/jar + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: kochetkovma/allure-server + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tags: "latest,${{ env.RELEASE_VERSION }}" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2a461c7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM gradle:jdk11 as build +COPY . . +RUN gradle -Pversion=docker --no-daemon bootJar + +FROM openjdk:11-jre-slim as production +COPY --from=build /home/gradle/build/libs/allure-server-docker.jar /allure-server-docker.jar +# Set port +EXPOSE 8080 +# Run application +ENTRYPOINT ["java","-jar","-Dspring.profiles.active=${PROFILE:-default}","/allure-server-docker.jar"] \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a2882ce..cf77a8e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,8 @@ # suppress inspection "UnusedProperty" for whole file theGroup=ru.iopump.qa -theArchivesBaseName=allure-server \ No newline at end of file +theArchivesBaseName=allure-server +# For build +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.configureondemand=true +org.gradle.jvmargs=-Xmx2024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 \ No newline at end of file diff --git a/src/main/java/ru/iopump/qa/allure/Application.java b/src/main/java/ru/iopump/qa/allure/Application.java index 445b546..6bf28e5 100644 --- a/src/main/java/ru/iopump/qa/allure/Application.java +++ b/src/main/java/ru/iopump/qa/allure/Application.java @@ -1,15 +1,14 @@ package ru.iopump.qa.allure; -import lombok.experimental.UtilityClass; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; -@UtilityClass @SpringBootApplication @EnableCaching -public class Application { - public void main(String[] args) { //NOPMD +public class Application { //NOPMD + + public static void main(String[] args) { //NOPMD SpringApplication.run(Application.class, args); } } \ No newline at end of file diff --git a/src/main/java/ru/iopump/qa/allure/controller/AllureResultController.java b/src/main/java/ru/iopump/qa/allure/controller/AllureResultController.java index 734f25a..e54d134 100644 --- a/src/main/java/ru/iopump/qa/allure/controller/AllureResultController.java +++ b/src/main/java/ru/iopump/qa/allure/controller/AllureResultController.java @@ -46,7 +46,7 @@ public class AllureResultController { private final ResultService resultService; @Operation(summary = "Delete all allure results") - @DeleteMapping(path = "/result") + @DeleteMapping @CacheEvict(value = CACHE, allEntries = true) // clear cache public Collection deleteAllResults() throws IOException { var res = getAllResult();