FROM alpine LABEL maintainer="vlad@deviant.guru" ARG APP ARG LUAJIT_TAG=v2.1 ARG ARCH=x86_64 RUN apk add --no-cache git alpine-sdk ca-certificates bash clang \ util-linux linux-headers RUN mkdir -p /src && cd /src && git clone https://github.com/LuaJIT/LuaJIT && cd LuaJIT && \ git checkout ${LUAJIT_TAG} && \ make XCFLAGS="-DLUAJIT_DISABLE_FFI -DLUAJIT_ENABLE_LUA52COMPAT" && \ make install COPY src /src/lilush/src COPY buildgen /src/lilush/buildgen # Optional external-pack build. When PACK_URL is set, clone the pack repo and # build the binary from its own build descriptor (build/${APP}.lua) instead of # an in-tree apps/${APP}.lua config. PACK_REF must be an immutable ref (tag or # commit SHA): changing it busts this layer, whereas a moving branch name would # silently reuse a stale cached clone. ARG PACK_URL="" ARG PACK_REF="" RUN if [ -n "$PACK_URL" ]; then \ git clone "$PACK_URL" /src/pack && cd /src/pack && git checkout "$PACK_REF"; \ fi RUN cd /src/lilush/buildgen && \ if [ -d /src/pack ]; then ./generate.lua /src/pack/build/${APP}.lua /src/pack; \ else ./generate.lua apps/${APP}.lua; fi