From b22a0efaa319418fa815762397e5e6586bf8fd9d Mon Sep 17 00:00:00 2001 From: ION606 Date: Fri, 11 Oct 2024 13:13:43 +0000 Subject: [PATCH] [Feature:Autograding] Add Erlang image (#53) ### Please check if the PR fulfills these requirements: * [X] Tests for the changes have been added/updated (if possible) * [X] Documentation has been updated/added if relevant ### What is the current behavior? N/A ### What is the new behavior? Can now run Erlang files ### Other information? I tested it using the code below ```erl -module(concurrency). -export([start/0, process/0]). start() -> Pid = spawn(concurrency, process, []), Pid ! {self(), "Hello"}, receive {Pid, Msg} -> io:format("Received message: ~p~n", [Msg]) end. process() -> receive {Sender, Msg} -> Sender ! {self(), Msg} end. ``` ![image](https://github.com/user-attachments/assets/8ee78e7a-5a29-4ecf-8669-348242d45a0d) --- dockerfiles/erlang/26/Dockerfile | 39 ++++++++++++++++++++++++++++++++ dockerfiles/erlang/metadata.json | 3 +++ 2 files changed, 42 insertions(+) create mode 100644 dockerfiles/erlang/26/Dockerfile create mode 100644 dockerfiles/erlang/metadata.json diff --git a/dockerfiles/erlang/26/Dockerfile b/dockerfiles/erlang/26/Dockerfile new file mode 100644 index 0000000..5a36096 --- /dev/null +++ b/dockerfiles/erlang/26/Dockerfile @@ -0,0 +1,39 @@ +# Use the base image +FROM ubuntu:22.04 + +WORKDIR /usr/src/app +ENV LANG=C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive +ENV KERL_BASE_DIR=/usr/local/kerl + +# Install dependencies for Erlang and the build process +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + build-essential \ + libncurses5-dev libsctp1 \ + ca-certificates wget curl git \ + autoconf m4 libssl-dev libwxgtk3.0-gtk3-dev libgl1-mesa-dev \ + libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop \ + locales; \ + rm -rf /var/lib/apt/lists/* + +# Install kerl to manage Erlang builds +RUN curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl && \ + chmod +x kerl && \ + mv kerl /usr/local/bin/kerl + +# Update kerl releases and build Erlang 26.0 +RUN kerl update releases +RUN MAKEFLAGS=-j6 kerl build 26.0 26.0_build +RUN kerl install 26.0_build /usr/local/erlang/26.0 + +# Cleanup the build files +RUN rm -rf /usr/local/kerl/builds/26.0_build + +# Activate the Erlang environment by default +RUN echo ". /usr/local/erlang/26.0/activate" >> /root/.bashrc && \ + echo ". /usr/local/erlang/26.0/activate" >> /etc/profile + +# Default command +CMD ["/bin/bash"] diff --git a/dockerfiles/erlang/metadata.json b/dockerfiles/erlang/metadata.json new file mode 100644 index 0000000..99c1ffc --- /dev/null +++ b/dockerfiles/erlang/metadata.json @@ -0,0 +1,3 @@ +{ + "pushLatest": false +}