diff --git a/Dockerfile b/Dockerfile index 4a1c43d..93dacb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:rolling +FROM ubuntu:focal ARG UID diff --git a/backend/src/langs.ts b/backend/src/langs.ts index 586a0b5..ec50166 100644 --- a/backend/src/langs.ts +++ b/backend/src/langs.ts @@ -79,6 +79,29 @@ int main() { main: "main.clj", run: "clojure -i main.clj -r", template: `(println "Hello, world!") +`, + }, + coffeescript: { + name: "CoffeeScript", + monacoLang: "coffee", + repl: "coffee", + main: "main.coffee", + compile: "coffee -b -c main.coffee", + run: `node -e ' +eval.apply(this, [require("fs").readFileSync("main.js", {encoding: "utf-8"})]) +require("/usr/lib/node_modules/coffeescript/repl").start() +'`, + template: `console.log "Hello, world!" +`, + }, + dart: { + name: "Dart", + monacoLang: "dart", + main: "main.dart", + run: "dart main.dart", + template: `void main() { + print('Hello, world!'); +} `, }, elixir: { @@ -97,6 +120,20 @@ int main() { main: "main.el", run: "emacs --load main.el --eval '(ielm)'", template: `(message "Hello, world!") +`, + }, + erlang: { + name: "Erlang", + monacoLang: "plaintext", + repl: "erl", + main: "main.erl", + compile: "erl -compile main", + run: "erl -s main main", + template: `-module(main). +-export([main/0]). + +main() -> + io:fwrite("Hello, world!\n"). `, }, fish: { @@ -183,6 +220,15 @@ main = putStrLn "Hello, world!" main: "main.lua", run: "lua -i main.lua", template: `print("Hello, world!") +`, + }, + nim: { + name: "Nim", + monacoLang: "plaintext", + main: "main.nim", + compile: "nim compile main.nim", + run: "./main", + template: `echo "Hello, world!" `, }, nodejs: { @@ -190,11 +236,22 @@ main = putStrLn "Hello, world!" monacoLang: "javascript", repl: "node", main: "main.js", - suffix: ` -require("repl").start(); -`, - run: "node main.js", + run: `node -e ' +eval.apply(this, [require("fs").readFileSync("main.js", {encoding: "utf-8"})]) +require("repl").start() +'`, template: `console.log("Hello, world!") +`, + }, + php: { + name: "PHP", + monacoLang: "php", + repl: "php -a", + main: "main.php", + run: "php -d auto_prepend_file=main.php -a", + template: ` main.js", + run: "NODE_PATH=/usr/lib/node_modules node main.js", + template: `print_string("Hello, world!\\n") `, }, ruby: { @@ -251,6 +317,15 @@ binding_irb.run(IRB.conf) template: `(begin (display "Hello, world!") (newline)) +`, + }, + sqlite: { + name: "SQLite", + monacoLang: "sql", + repl: "sqlite3", + main: "main.sql", + run: `sqlite3 -cmd "$(< main.sql)"`, + template: `SELECT "Hello, world!" `, }, swift: { @@ -260,6 +335,15 @@ binding_irb.run(IRB.conf) compile: "swiftc main.swift", run: "./main", template: `print("Hello, world!") +`, + }, + typescript: { + name: "TypeScript", + monacoLang: "typescript", + repl: "ts-node", + main: "main.ts", + run: `ts-node -i -e "$(< main.ts)"`, + template: `console.log("Hello, world!"); `, }, vim: { diff --git a/scripts/docker-install.bash b/scripts/docker-install.bash index 07de95d..43bcd4a 100755 --- a/scripts/docker-install.bash +++ b/scripts/docker-install.bash @@ -12,10 +12,11 @@ uid="$1" export DEBIAN_FRONTEND=noninteractive apt-get update -apt-get install -y apt-transport-https curl gnupg lsb-release +apt-get install -y apt-transport-https curl gnupg lsb-release wget rm -rf /var/lib/apt/lists/* curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - +curl -sSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - curl -sSL https://keybase.io/crystal/pgp_keys.asc | apt-key add - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 @@ -26,11 +27,12 @@ dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<"EOF" +deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ deb https://deb.nodesource.com/node_14.x focal main deb https://dist.crystal-lang.org/apt crystal main deb https://dl.yarnpkg.com/debian/ stable main -deb-src https://deb.nodesource.com/node_14.x +deb-src https://deb.nodesource.com/node_14.x focal main EOF packages=" @@ -40,6 +42,7 @@ bash git make nodejs +npm yarn # Handy utilities @@ -47,6 +50,7 @@ bsdmainutils curl emacs-nox git +jq lsof make man-db @@ -71,12 +75,18 @@ clojure # Crystal crystal +# Dart +dart + # Elixir elixir # Emacs Lisp emacs-nox +# Erlang +erlang + # F# fsharp @@ -99,10 +109,16 @@ julia # Lua lua5.3 +# Nim +nim + # Node.js nodejs yarn +# PHP +php + # Python python3 python3-pip @@ -120,6 +136,9 @@ rustc # Scheme mit-scheme +# SQLite +sqlite + # Swift libpython2.7 @@ -136,11 +155,22 @@ apt-get update apt-get install -y $(grep -v "^#" <<< "$packages") rm -rf /var/lib/apt/lists/* +# CoffeeScript +npm install -g coffeescript + +# TypeScript +npm install -g ts-node typescript + +# ReasonML +npm install -g bs-platform + +# Needed for project infrastructure cd /tmp wget -nv https://github.com/watchexec/watchexec/releases/download/1.13.1/watchexec-1.13.1-x86_64-unknown-linux-gnu.deb dpkg -i watchexec-*.deb rm watchexec-*.deb +# Kotlin cd /tmp wget -nv https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip unzip kotlin-*.zip @@ -148,6 +178,7 @@ cp kotlinc/bin/* /usr/bin/ cp kotlinc/lib/* /usr/lib/ rm -rf kotlin-*.zip kotlinc +# Swift cd /tmp wget -nv https://swift.org/builds/swift-5.2.4-release/ubuntu2004/swift-5.2.4-RELEASE/swift-5.2.4-RELEASE-ubuntu20.04.tar.gz mkdir /opt/swift