Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

[WIP]Add Kotlin #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions server/container/openjdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
FROM openjdk:11-jdk-slim-buster
LABEL maintainer="Ryota Egusa <[email protected]>"

ENV JAVA_HOME /usr/local/openjdk-11

RUN apt-get update \
&& apt-get install time sudo \
&& apt-get clean

ENV KOTLIN_COMPILER_VERSION 1.3.41

RUN apt-get update \
&& apt-get install -y wget unzip \
&& wget https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_COMPILER_VERSION}/kotlin-compiler-${KOTLIN_COMPILER_VERSION}.zip -O /tmp/kotlin-compiler.zip \
&& unzip /tmp/kotlin-compiler.zip -d /usr/lib \
&& rm -f /tmp/kotlin-compiler.zip \
&& apt-get remove -y wget unzip \
&& apt-get autoremove -y \
&& apt-get clean

ENV PATH $PATH:/usr/lib/kotlinc/bin

RUN sh -c 'echo 127.0.1.1 $(hostname) >> /etc/hosts'

RUN mkdir /tmp/koj-workspace && chmod 777 /tmp/koj-workspace
8 changes: 8 additions & 0 deletions server/models/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ func seedLanguages() {
CompileCommand: "/usr/local/openjdk-11/bin/javac -d classes Main.java && /usr/local/openjdk-11/bin/jar --create --file main.jar --main-class Main -C classes .",
ExecCommand: "/usr/local/openjdk-11/bin/java -XX:+UseContainerSupport -jar main.jar",
},
{
ImageName: "openjdk",
DisplayName: "Kotlin (1.3.41)",
FileName: "Main.kt",
ExeFileName: "main.jar",
CompileCommand: "JAVACMD=/usr/local/openjdk-11/bin/java /usr/lib/kotlinc/bin/kotlinc Main.kt -include-runtime -jdk-home /usr/local/openjdk-11 -d main.jar",
ExecCommand: "/usr/local/openjdk-11/bin/java -XX:+UseContainerSupport -cp main.jar MainKt",
},
}

for _, l := range languages {
Expand Down