build: install lua from the os package repository (#5655)

- Install lua and luarocks from the OS package repository instead of
  manually downloading them. Also the luarock fork looked
  unmaintained.
- Remove luarocks from the image after installing lua packages because
  it's not needed after that
This commit is contained in:
Marco Ferrari 2024-05-28 08:39:07 +02:00 committed by GitHub
parent 13f6ec2ffb
commit 6af32f6575
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,39 +2,21 @@
set -euo pipefail set -euo pipefail
apk add --no-cache \
lua5.4
apk add --no-cache --virtual .lua-build-deps \ apk add --no-cache --virtual .lua-build-deps \
gcc \ gcc \
lua5.4-dev \
luarocks5.4 \
make \ make \
musl-dev \ musl-dev \
readline-dev readline-dev
curl --retry 5 --retry-delay 5 -s https://www.lua.org/ftp/lua-5.3.5.tar.gz | tar -xz ln -s /usr/bin/lua5.4 /usr/bin/lua
cd lua-5.3.5
make linux
make install
cd .. && rm -r lua-5.3.5/
url=$( luarocks-5.4 install luacheck
set -euo pipefail luarocks-5.4 install argparse
curl -s \ luarocks-5.4 install luafilesystem
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
https://api.github.com/repos/cvega/luarocks/releases/latest |
jq -r '.tarball_url'
)
curl --retry 5 --retry-delay 5 -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
"${url}" | tar -xz
cd cvega-luarocks-6b1aee6
./configure --with-lua-include=/usr/local/include
make
make -b install
cd ..
rm -r cvega-luarocks-6b1aee6
luarocks install luacheck
luarocks install argparse
luarocks install luafilesystem
apk del --no-network --purge .lua-build-deps apk del --no-network --purge .lua-build-deps