FROM alpine
RUN apk update && apk add \
	git \
	make \
	gcc \
	musl-dev
RUN git clone --depth 1 --recursive https://github.com/ers35/luastatic \
    /opt/spm/luastatic-master
WORKDIR /opt/spm/luastatic-master
COPY --from=lua:5.4.6 /opt/spm/lua-5.4.6/ /usr/local/
RUN make -j$(nproc --all) \
    LUA=lua \
    LIBLUA_A=/usr/local/lib/liblua.a \
    LUA_INCLUDE=/usr/local/include \
    CFLAGS=-static
RUN strip luastatic
