diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7038a3a..bf00ef1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,3 +23,5 @@ jobs: run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build + - name: Build fat jar with Gradle + run: ./gradlew customFatJar \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 371036a..7148bcc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -21,7 +21,7 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build + run: ./gradlew customFatJar - name: Build image (application) run: docker build -t test-image:latest . - name: Start container (application) diff --git a/Dockerfile b/Dockerfile index 89cb90d..37c8c23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM amazoncorretto:11-alpine-jdk -COPY build/libs/adyen-java-online-payments-0.1.jar adyen-java-online-payments-0.1.jar -ENTRYPOINT ["java","-jar","/adyen-java-online-payments-0.1.jar"] +FROM --platform=linux/amd64 amazoncorretto:11-alpine-jdk +COPY build/libs/adyen-java-online-payments-fat-0.1.jar adyen-java-online-payments-fat-0.1.jar +ENTRYPOINT ["java","-jar","/adyen-java-online-payments-fat-0.1.jar"] diff --git a/build.gradle b/build.gradle index 124da92..acac69b 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,8 @@ plugins { id 'application' } +apply plugin: 'java' + version '0.1' sourceCompatibility = 1.11 @@ -26,3 +28,22 @@ dependencies { implementation 'org.apache.httpcomponents:httpclient:4.5.11' implementation 'com.adyen:adyen-java-api-library:17.2.0' } + +jar { + manifest { + attributes( + 'Main-Class': 'checkout.Application' + ) + } +} + +task customFatJar(type: Jar) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + manifest { + attributes 'Main-Class': 'checkout.Application' + } + baseName = 'adyen-java-online-payments-fat' + from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + with jar +} \ No newline at end of file diff --git a/startDocker.sh b/startDocker.sh new file mode 100755 index 0000000..f4b45a0 --- /dev/null +++ b/startDocker.sh @@ -0,0 +1,6 @@ +docker run \ +-e ADYEN_CLIENT_KEY \ +-e ADYEN_MERCHANT_ACCOUNT \ +-e ADYEN_HMAC_KEY \ +-e ADYEN_API_KEY \ +-p8080:8080 online-payments-spark-adyen:latest