diff --git a/Dockerfile.dev b/Dockerfile.dev index efe6904..5c7df74 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -32,6 +32,12 @@ RUN /tmp/docker-install-phase5.bash COPY scripts/docker-install-phase6.bash /tmp/ RUN /tmp/docker-install-phase6.bash "$UID" +COPY scripts/docker-install-phase7.bash /tmp/ +RUN /tmp/docker-install-phase7.bash "$UID" + +COPY scripts/docker-install-phase8.bash /tmp/ +RUN /tmp/docker-install-phase8.bash "$UID" + USER docker WORKDIR /home/docker RUN chmod go-rwx /home/docker diff --git a/Dockerfile.prod b/Dockerfile.prod index a69919d..38f0854 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -34,6 +34,12 @@ RUN /tmp/docker-install-phase5.bash COPY scripts/docker-install-phase6.bash /tmp/ RUN /tmp/docker-install-phase6.bash +COPY scripts/docker-install-phase7.bash /tmp/ +RUN /tmp/docker-install-phase7.bash "$UID" + +COPY scripts/docker-install-phase8.bash /tmp/ +RUN /tmp/docker-install-phase8.bash "$UID" + USER docker WORKDIR /home/docker RUN chmod go-rwx /home/docker diff --git a/backend/src/langs.ts b/backend/src/langs.ts index 6193c94..c6cb5c4 100644 --- a/backend/src/langs.ts +++ b/backend/src/langs.ts @@ -321,6 +321,7 @@ void main() { repl: "iex", main: "main.exs", run: "iex main.exs", + lsp: "/opt/elixir-ls/language_server.sh", template: `IO.puts("Hello, world!") `, }, diff --git a/scripts/docker-install-phase1.bash b/scripts/docker-install-phase1.bash index 5f47de2..61f4e24 100755 --- a/scripts/docker-install-phase1.bash +++ b/scripts/docker-install-phase1.bash @@ -3,6 +3,7 @@ set -e set -o pipefail set -x +pushd /tmp >/dev/null dpkg --add-architecture i386 @@ -17,7 +18,6 @@ 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 -cd /tmp wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb @@ -33,4 +33,5 @@ EOF add-apt-repository -y -n ppa:deadsnakes/ppa +popd >/dev/null rm "$0" diff --git a/scripts/docker-install-phase4.bash b/scripts/docker-install-phase4.bash index 985a13b..21448f8 100755 --- a/scripts/docker-install-phase4.bash +++ b/scripts/docker-install-phase4.bash @@ -4,15 +4,16 @@ set -e set -o pipefail set -x -# Needed for project infrastructure -cd /tmp +# Package manager - Julia mkdir /opt/julia export JULIA_DEPOT_PATH=/opt/julia +# Package manager - Node.js npm config set unsafe-perm true PERL_MM_USE_DEFAULT=1 cpan App::cpanminus rm -rf /tmp/cpan_install_*.txt +# Package manager - Rust export CARGO_HOME=/opt/rust export RUSTUP_HOME=/opt/rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path diff --git a/scripts/docker-install-phase5.bash b/scripts/docker-install-phase5.bash index 0b5986f..1716cda 100755 --- a/scripts/docker-install-phase5.bash +++ b/scripts/docker-install-phase5.bash @@ -3,26 +3,18 @@ set -e set -o pipefail set -x +pushd /tmp >/dev/null # 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 -cd /tmp git clone https://github.com/circulosmeos/gdown.pl.git mv gdown.pl/gdown.pl /usr/bin/gdown rm -rf gdown.pl -cd /tmp -wget https://get.haskellstack.org/stable/linux-x86_64-static.tar.gz -tar -xf linux-x86_64-static.tar.gz -mv stack-*-linux-x86_64-static/stack /usr/bin/stack -rm -rf stack-*-linux-x86_64-static linux-x86_64-static.tar.gz - # Ada -cd /tmp wget -nv https://dl.bintray.com/reznikmm/ada-language-server/linux-latest.tar.gz tar -xf linux-latest.tar.gz mv linux/ada_language_server /usr/bin/ada_language_server @@ -30,19 +22,21 @@ mv linux/*.so* /usr/lib/x86_64-linux-gnu/ rm linux-latest.tar.gz # Clojure -cd /tmp wget -nv https://github.com/snoe/clojure-lsp/releases/download/release-20200629T153107/clojure-lsp chmod +x clojure-lsp mv clojure-lsp /usr/bin/clojure-lsp # D -cd /tmp wget -nv http://downloads.dlang.org/releases/2.x/2.092.0/dmd_2.092.0-0_amd64.deb dpkg -i dmd_*.deb rm dmd_*.deb +# Elixir +wget -nv https://github.com/elixir-lsp/elixir-ls/releases/download/v0.5.0/elixir-ls.zip +unzip -d /opt/elixir-ls elixir-ls.zip +ln -s /opt/elixir-ls/language_server.sh /usr/bin/elixir-ls + # Elm -cd /tmp wget -nv https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz gunzip binary-for-linux-64-bit.gz chmod +x binary-for-linux-64-bit @@ -54,8 +48,18 @@ export GOPATH=/tmp/go mv /tmp/go/bin/gopls /usr/bin/gopls rm -rf /tmp/go +# Haskell +wget https://get.haskellstack.org/stable/linux-x86_64-static.tar.gz +tar -xf linux-x86_64-static.tar.gz +mv stack-*-linux-x86_64-static/stack /usr/bin/stack +rm -rf stack-*-linux-x86_64-static linux-x86_64-static.tar.gz + +mkdir -p /opt/haskell +gdown "https://drive.google.com/uc?export=download&id=1GPoR_ja4ns16KCamRgwB-JVag4HK0igz" /usr/bin/hie +gdown "https://drive.google.com/uc?export=download&id=1qSxj8JjAeetAmNjUGayX0RBARgr5R4Ij" /opt/haskell/hoogle.hoo +chmod +x /usr/bin/hie + # Ink -cd /tmp wget -nv https://github.com/thesephist/ink/releases/download/v0.1.7/ink-linux wget -nv https://github.com/thesephist/ink/releases/download/v0.1.7/std.ink wget -nv https://github.com/thesephist/ink/releases/download/v0.1.7/str.ink @@ -65,7 +69,6 @@ mkdir /opt/ink mv std.ink str.ink /opt/ink/ # Kotlin -cd /tmp wget -nv https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip unzip kotlin-*.zip cp kotlinc/bin/* /usr/bin/ @@ -73,7 +76,6 @@ cp kotlinc/lib/* /usr/lib/ rm -rf kotlin-*.zip kotlinc # PowerShell -cd /tmp wget -nv https://github.com/PowerShell/PowerShell/releases/download/v7.0.1/powershell-7.0.1-linux-x64.tar.gz mkdir /opt/powershell tar -xf powershell-*.tar.gz -C /opt/powershell @@ -81,7 +83,6 @@ ln -s /opt/powershell/pwsh /usr/bin/pwsh rm powershell-*.tar.gz # Python -cd /tmp xml="$(curl -sSL "https://pvsc.blob.core.windows.net/python-language-server-stable?restype=container&comp=list&prefix=Python-Language-Server-linux-x64")" nupkg="$(echo "$xml" | grep -Eo 'https://[^<]+\.nupkg' | tail -n1)" wget -nv "${nupkg}" @@ -101,171 +102,11 @@ popd >/dev/null rm -rf snobol4-* # Swift -cd /tmp gdown "https://drive.google.com/uc?export=download&id=1eE1-VuZz0gv-fITaGVT_r1UunCLjS-JT" swift.tar.gz mkdir /opt/swift tar -xf swift.tar.gz -C /opt/swift --strip-components=2 ln -s /opt/swift/bin/swiftc /usr/bin/swiftc rm swift.tar.gz -# Haskell -mkdir -p /opt/haskell -gdown "https://drive.google.com/uc?export=download&id=1GPoR_ja4ns16KCamRgwB-JVag4HK0igz" /usr/bin/hie -gdown "https://drive.google.com/uc?export=download&id=1qSxj8JjAeetAmNjUGayX0RBARgr5R4Ij" /opt/haskell/hoogle.hoo -chmod +x /usr/bin/hie - -# Kalyn -cd /tmp -git clone https://github.com/raxod502/kalyn.git -pushd kalyn >/dev/null -stack build kalyn -mv "$(stack exec which kalyn)" /usr/bin/kalyn -mkdir /opt/kalyn -cp -R src-kalyn/Stdlib src-kalyn/Stdlib.kalyn /opt/kalyn/ popd >/dev/null -rm -rf kalyn - -# LOLCODE -cd /tmp -git clone https://github.com/justinmeza/lci.git -pushd lci >/dev/null -python3 install.py --prefix=/usr -popd >/dev/null -rm -rf lci - -# Malbolge -cd /tmp -git clone https://github.com/bipinu/malbolge.git -clang malbolge/malbolge.c -o /usr/bin/malbolge -rm -rf malbolge - -# Befunge -tee /usr/bin/befunge-repl >/dev/null <<"EOF" -#!/usr/bin/env -S NODE_PATH=/usr/lib/node_modules node -const fs = require("fs"); - -const Befunge = require("befunge93"); -const prompt = require("prompt-sync")(); - -const befunge = new Befunge(); -befunge.onInput = prompt; -befunge.onOutput = (output) => { - if (typeof output === "string") { - process.stdout.write(output); - } else { - process.stdout.write(output + " "); - } -}; - -const args = process.argv.slice(2); -if (args.length !== 1) { - console.error("usage: befunge-repl FILE"); - process.exit(1); -} - -befunge.run(fs.readFileSync(args[0], { encoding: "utf-8" })).catch((err) => { - console.error(err); - process.exit(1); -}); -EOF -chmod +x /usr/bin/befunge-repl - -# BrainF -tee /usr/bin/brainf-repl >/dev/null <<"EOF" -#!/usr/bin/env python3 -import argparse -import readline -import subprocess -import tempfile - -parser = argparse.ArgumentParser() -parser.add_argument("file", nargs="?") -args = parser.parse_args() - -if args.file: - subprocess.run(["beef", args.file]) -while True: - try: - code = input("bf> ") - except KeyboardInterrupt: - print("^C") - continue - except EOFError: - print("^D") - break - if not code: - continue - with tempfile.NamedTemporaryFile(mode="w") as f: - f.write(code) - f.flush() - subprocess.run(["beef", f.name]) -EOF -chmod +x /usr/bin/brainf-repl - -# Elm -mkdir /opt/elm -tee /opt/elm/elm.json >/dev/null <<"EOF" -{ - "type": "application", - "source-directories": [ - "." - ], - "elm-version": "0.19.1", - "dependencies": { - "direct": { - "elm/browser": "1.0.2", - "elm/core": "1.0.5", - "elm/html": "1.0.0" - }, - "indirect": { - "elm/json": "1.1.3", - "elm/time": "1.0.0", - "elm/url": "1.0.0", - "elm/virtual-dom": "1.0.2" - } - }, - "test-dependencies": { - "direct": {}, - "indirect": {} - } -} -EOF - -# Haskell -mkdir -p /opt/haskell -tee /opt/haskell/hie.yaml >/dev/null <<"EOF" -cradle: - direct: - arguments: [] -EOF - -# Unlambda -tee /usr/bin/unlambda-repl >/dev/null <<"EOF" -#!/usr/bin/env python3 -import argparse -import readline -import subprocess - -parser = argparse.ArgumentParser() -parser.add_argument("file", nargs="?") -args = parser.parse_args() - -if args.file: - with open(args.file) as f: - subprocess.run(["unlambda"], input=f.read(), encoding="utf-8") -while True: - try: - code = input("λ> ") - except KeyboardInterrupt: - print("^C") - continue - except EOFError: - print("^D") - break - if not code: - continue - subprocess.run(["unlambda"], input=code, encoding="utf-8") -EOF -chmod +x /usr/bin/unlambda-repl - rm "$0" diff --git a/scripts/docker-install-phase6.bash b/scripts/docker-install-phase6.bash index eefee5a..4efcf57 100755 --- a/scripts/docker-install-phase6.bash +++ b/scripts/docker-install-phase6.bash @@ -4,21 +4,133 @@ set -e set -o pipefail set -x -uid="$1" +# Befunge +tee /usr/bin/befunge-repl >/dev/null <<"EOF" +#!/usr/bin/env -S NODE_PATH=/usr/lib/node_modules node +const fs = require("fs"); -rm -rf /tmp/hsperfdata_root +const Befunge = require("befunge93"); +const prompt = require("prompt-sync")(); -if [[ -n "$uid" ]] && (( "$uid" != 0 )); then - useradd --uid="$uid" --password "!" --create-home --groups sudo docker -else - useradd --password "!" --create-home --groups sudo docker -fi +const befunge = new Befunge(); +befunge.onInput = prompt; +befunge.onOutput = (output) => { + if (typeof output === "string") { + process.stdout.write(output); + } else { + process.stdout.write(output + " "); + } +}; -tee /etc/sudoers.d/99-passwordless >/dev/null <<"EOF" -%sudo ALL=(ALL:ALL) NOPASSWD: ALL +const args = process.argv.slice(2); +if (args.length !== 1) { + console.error("usage: befunge-repl FILE"); + process.exit(1); +} + +befunge.run(fs.readFileSync(args[0], { encoding: "utf-8" })).catch((err) => { + console.error(err); + process.exit(1); +}); +EOF +chmod +x /usr/bin/befunge-repl + +# BrainF +tee /usr/bin/brainf-repl >/dev/null <<"EOF" +#!/usr/bin/env python3 +import argparse +import readline +import subprocess +import tempfile + +parser = argparse.ArgumentParser() +parser.add_argument("file", nargs="?") +args = parser.parse_args() + +if args.file: + subprocess.run(["beef", args.file]) +while True: + try: + code = input("bf> ") + except KeyboardInterrupt: + print("^C") + continue + except EOFError: + print("^D") + break + if not code: + continue + with tempfile.NamedTemporaryFile(mode="w") as f: + f.write(code) + f.flush() + subprocess.run(["beef", f.name]) +EOF +chmod +x /usr/bin/brainf-repl + +# Elm +mkdir /opt/elm +tee /opt/elm/elm.json >/dev/null <<"EOF" +{ + "type": "application", + "source-directories": [ + "." + ], + "elm-version": "0.19.1", + "dependencies": { + "direct": { + "elm/browser": "1.0.2", + "elm/core": "1.0.5", + "elm/html": "1.0.0" + }, + "indirect": { + "elm/json": "1.1.3", + "elm/time": "1.0.0", + "elm/url": "1.0.0", + "elm/virtual-dom": "1.0.2" + } + }, + "test-dependencies": { + "direct": {}, + "indirect": {} + } +} EOF -touch /home/docker/.zshrc -chown docker:docker /home/docker/.zshrc +# Haskell +mkdir -p /opt/haskell +tee /opt/haskell/hie.yaml >/dev/null <<"EOF" +cradle: + direct: + arguments: [] +EOF + +# Unlambda +tee /usr/bin/unlambda-repl >/dev/null <<"EOF" +#!/usr/bin/env python3 +import argparse +import readline +import subprocess + +parser = argparse.ArgumentParser() +parser.add_argument("file", nargs="?") +args = parser.parse_args() + +if args.file: + with open(args.file) as f: + subprocess.run(["unlambda"], input=f.read(), encoding="utf-8") +while True: + try: + code = input("λ> ") + except KeyboardInterrupt: + print("^C") + continue + except EOFError: + print("^D") + break + if not code: + continue + subprocess.run(["unlambda"], input=code, encoding="utf-8") +EOF +chmod +x /usr/bin/unlambda-repl rm "$0" diff --git a/scripts/docker-install-phase7.bash b/scripts/docker-install-phase7.bash new file mode 100755 index 0000000..29e0075 --- /dev/null +++ b/scripts/docker-install-phase7.bash @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail +set -x +pushd /tmp >/dev/null + +# Kalyn +git clone https://github.com/raxod502/kalyn.git +pushd kalyn >/dev/null +stack build kalyn +mv "$(stack exec which kalyn)" /usr/bin/kalyn +mkdir /opt/kalyn +cp -R src-kalyn/Stdlib src-kalyn/Stdlib.kalyn /opt/kalyn/ +popd >/dev/null +rm -rf kalyn + +# LOLCODE +git clone https://github.com/justinmeza/lci.git +pushd lci >/dev/null +python3 install.py --prefix=/usr +popd >/dev/null +rm -rf lci + +# Malbolge +git clone https://github.com/bipinu/malbolge.git +clang malbolge/malbolge.c -o /usr/bin/malbolge +rm -rf malbolge + +popd >/dev/null +rm "$0" diff --git a/scripts/docker-install-phase8.bash b/scripts/docker-install-phase8.bash new file mode 100755 index 0000000..eefee5a --- /dev/null +++ b/scripts/docker-install-phase8.bash @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail +set -x + +uid="$1" + +rm -rf /tmp/hsperfdata_root + +if [[ -n "$uid" ]] && (( "$uid" != 0 )); then + useradd --uid="$uid" --password "!" --create-home --groups sudo docker +else + useradd --password "!" --create-home --groups sudo docker +fi + +tee /etc/sudoers.d/99-passwordless >/dev/null <<"EOF" +%sudo ALL=(ALL:ALL) NOPASSWD: ALL +EOF + +touch /home/docker/.zshrc +chown docker:docker /home/docker/.zshrc + +rm "$0"