FROM alpine
RUN apk update && apk add \
	git \
	make \
	gcc \
	musl-dev \
	wget
RUN wget https://www.lua.org/ftp/lua-5.4.6.tar.gz
RUN tar -xf lua-5.4.6.tar.gz
WORKDIR /lua-5.4.6
ARG PREFIX=/opt/spm/lua-5.4.6
RUN make -j$(nproc --all) CFLAGS="-std=gnu99 -Os -Wall -Wextra \
	-DLUA_COMPAT_5_3 -DLUA_USE_LINUX \
	-ffunction-sections -fdata-sections"
RUN make install INSTALL_TOP=$PREFIX
