From 389804bc732bb92bcd998361153a34ab8d46661d Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sun, 14 Aug 2022 14:56:50 +0200 Subject: [PATCH] feat: Add images for Lua library testing --- Justfile | 10 ++++++ lua-clib-pulse/Dockerfile | 9 +++++ lua-clib-x11/Dockerfile | 10 ++++++ lua-clib/Dockerfile | 69 +++++++++++++++++++++++++++++++++++++++ lua-clib/disable-lua | 2 ++ lua-clib/enable-lua | 5 +++ lua-clib/run-with-lua | 13 ++++++++ 7 files changed, 118 insertions(+) create mode 100644 Justfile create mode 100644 lua-clib-pulse/Dockerfile create mode 100644 lua-clib-x11/Dockerfile create mode 100644 lua-clib/Dockerfile create mode 100755 lua-clib/disable-lua create mode 100755 lua-clib/enable-lua create mode 100755 lua-clib/run-with-lua diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..7c5546e --- /dev/null +++ b/Justfile @@ -0,0 +1,10 @@ +build image: + docker build -t {{image}} {{image}} + docker tag {{image}} {{image}}:dev + +tag image version: + docker tag {{image}} {{image}}:{{version}} + +push host image version: + docker tag {{image}}:{{version}} {{host}}/{{image}}:{{version}} + docker push {{host}}/{{image}}:{{version}} diff --git a/lua-clib-pulse/Dockerfile b/lua-clib-pulse/Dockerfile new file mode 100644 index 0000000..af74ff2 --- /dev/null +++ b/lua-clib-pulse/Dockerfile @@ -0,0 +1,9 @@ +FROM lua-clib + +RUN set -e; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + gobject-introspection \ + libgirepository1.0-dev \ + libpulse-dev; \ + rm -rf /var/cache/apt/* diff --git a/lua-clib-x11/Dockerfile b/lua-clib-x11/Dockerfile new file mode 100644 index 0000000..65329f4 --- /dev/null +++ b/lua-clib-x11/Dockerfile @@ -0,0 +1,10 @@ +FROM lua-clib + +RUN set -e; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libx11-dev \ + libx11-xcb-dev\ + xauth \ + xvfb; \ + rm -rf /var/cache/apt/* diff --git a/lua-clib/Dockerfile b/lua-clib/Dockerfile new file mode 100644 index 0000000..5fc4bcc --- /dev/null +++ b/lua-clib/Dockerfile @@ -0,0 +1,69 @@ +FROM debian:bullseye-slim + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -e; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + cmake \ + gcc \ + g++ \ + libc-dev \ + libreadline-dev \ + nodejs \ + npm \ + make \ + stow \ + sudo \ + unzip \ + wget; \ + rm -rf /var/cache/apt/* + +WORKDIR /build + +RUN set -e; \ + wget http://www.lua.org/ftp/lua-5.1.5.tar.gz; \ + tar -xzf lua-5.1.5.tar.gz; \ + cd lua-5.1.5/src; \ + make -j $(nproc) all MYCFLAGS="-DLUA_USE_LINUX -fPIC" MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"; \ + cd ..; \ + make INSTALL_TOP=/usr/local/stow/lua5.1 install; \ + cd /build; \ + wget http://www.lua.org/ftp/lua-5.2.4.tar.gz; \ + tar -xzf lua-5.2.4.tar.gz; \ + cd lua-5.2.4/src; \ + make -j $(nproc) linux MYCFLAGS="-fPIC"; \ + cd ..; \ + make INSTALL_TOP=/usr/local/stow/lua5.2 install; \ + cd /build; \ + wget http://www.lua.org/ftp/lua-5.3.6.tar.gz; \ + tar -xzf lua-5.3.6.tar.gz; \ + cd lua-5.3.6/src; \ + make -j $(nproc) linux MYCFLAGS="-fPIC"; \ + cd ..; \ + make INSTALL_TOP=/usr/local/stow/lua5.3 install; \ + cd /build; \ + wget http://www.lua.org/ftp/lua-5.4.4.tar.gz; \ + tar -xzf lua-5.4.4.tar.gz; \ + cd lua-5.4.4/src; \ + make -j $(nproc) linux MYCFLAGS="-fPIC"; \ + cd ..; \ + make INSTALL_TOP=/usr/local/stow/lua5.4 install; \ + cd /build; \ + wget https://luarocks.org/releases/luarocks-3.9.1.tar.gz; \ + tar -xzf luarocks-3.9.1.tar.gz; \ + cd luarocks-3.9.1; \ + ./configure --prefix=/usr --with-lua=/usr/local/stow/lua5.4; \ + make -j $(nproc); \ + make install; \ + cd /build; \ + wget https://github.com/sass/dart-sass/releases/download/1.54.4/dart-sass-1.54.4-linux-x64.tar.gz; \ + tar -xzf dart-sass-1.54.4-linux-x64.tar.gz; \ + mv dart-sass/sass /usr/bin/sass; \ + cd /; \ + rm -r /build + +WORKDIR / + +COPY enable-lua disable-lua run-with-lua /usr/bin/ diff --git a/lua-clib/disable-lua b/lua-clib/disable-lua new file mode 100755 index 0000000..94c5843 --- /dev/null +++ b/lua-clib/disable-lua @@ -0,0 +1,2 @@ +#!/bin/sh +stow -d /usr/local/stow -t /usr -D "lua$1" diff --git a/lua-clib/enable-lua b/lua-clib/enable-lua new file mode 100755 index 0000000..f2a4946 --- /dev/null +++ b/lua-clib/enable-lua @@ -0,0 +1,5 @@ +#!/bin/sh +stow -d /usr/local/stow -t /usr -S "lua$1" +# Sometimes, most often with 5.4, a build fails to install rocks claiming that this +# directory was missing/couldn't be created. Simply create it to avoid the error. +mkdir -p /usr/lib/luarocks/rock-$1 diff --git a/lua-clib/run-with-lua b/lua-clib/run-with-lua new file mode 100755 index 0000000..70f2f01 --- /dev/null +++ b/lua-clib/run-with-lua @@ -0,0 +1,13 @@ +#!/bin/sh + +LUA_VERSION="$1" +shift + +sudo enable-lua "$LUA_VERSION" + +"$@" +ret=$! + +sudo disable-lua "$LUA_VERSION" + +exit $ret