SNRK-100: Dockerfile as application

This commit is contained in:
Kirill Grachev 2023-05-19 16:31:43 +03:00
parent 7c5e2b7dbb
commit 652b865b89
5 changed files with 32 additions and 3 deletions

View File

@ -1,8 +1,23 @@
FROM ubuntu:latest 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 . . COPY . .
RUN ./requirments.sh RUN ./requirments.sh
RUN ./gradlew build test
RUN ./gradlew clean build
EXPOSE 8080
CMD ./gradlew :snark-main:run_server

View File

@ -1,4 +1,4 @@
set -e #!/bin/bash
apt-get update apt-get update
apt-get install -y sudo apt-get install -y sudo

View File

@ -19,3 +19,8 @@ dependencies {
tasks.test { tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
tasks.register<JavaExec>("run_server") {
classpath = sourceSets.main.get().runtimeClasspath
main = "space.kscience.snark.main.MainKt"
}

6
snark-main/ci/install_java.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
JAVA_VERSION="$1"
source ~/.sdkman/bin/sdkman-init.sh
sdk install java "$JAVA_VERSION"

3
snark-main/ci/install_sdk.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
curl -s "https://get.sdkman.io" | bash