diff --git a/Dockerfile b/Dockerfile index 05d2f2d..f879477 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,23 @@ FROM ubuntu:latest -WORKDIR Snark +RUN apt-get update +RUN apt-get install -y curl zip unzip + +ARG JAVA_VERSION="17.0.7-zulu" + +WORKDIR /app + +COPY ./snark-main/ci ./snark-main/ci + +RUN ./snark-main/ci/install_sdk.sh +RUN ./snark-main/ci/install_java.sh "$JAVA_VERSION" COPY . . RUN ./requirments.sh -RUN ./gradlew build test \ No newline at end of file + +RUN ./gradlew clean build + +EXPOSE 8080 + +CMD ./gradlew :snark-main:run_server \ No newline at end of file diff --git a/requirments.sh b/requirments.sh index 8878fdb..2b38e31 100755 --- a/requirments.sh +++ b/requirments.sh @@ -1,4 +1,4 @@ -set -e +#!/bin/bash apt-get update apt-get install -y sudo diff --git a/snark-main/build.gradle.kts b/snark-main/build.gradle.kts index 819f8f0..c8422da 100644 --- a/snark-main/build.gradle.kts +++ b/snark-main/build.gradle.kts @@ -19,3 +19,8 @@ dependencies { tasks.test { useJUnitPlatform() } + +tasks.register("run_server") { + classpath = sourceSets.main.get().runtimeClasspath + main = "space.kscience.snark.main.MainKt" +} diff --git a/snark-main/ci/install_java.sh b/snark-main/ci/install_java.sh new file mode 100755 index 0000000..70b0687 --- /dev/null +++ b/snark-main/ci/install_java.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +JAVA_VERSION="$1" + +source ~/.sdkman/bin/sdkman-init.sh +sdk install java "$JAVA_VERSION" diff --git a/snark-main/ci/install_sdk.sh b/snark-main/ci/install_sdk.sh new file mode 100755 index 0000000..df6f5c0 --- /dev/null +++ b/snark-main/ci/install_sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -s "https://get.sdkman.io" | bash