Skip to content

Instantly share code, notes, and snippets.

@creationix
Last active November 14, 2022 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationix/90e74a284ebca13a6c4fdc71159b7f85 to your computer and use it in GitHub Desktop.
Save creationix/90e74a284ebca13a6c4fdc71159b7f85 to your computer and use it in GitHub Desktop.
Build luvit from source using alpine docker
FROM alpine AS build-luv
RUN apk add build-base cmake git
RUN git clone --recursive https://github.com/luvit/luvi.git
RUN make -C luvi/deps/luv
FROM alpine AS build-luvi
RUN apk add build-base cmake git
RUN git clone --recursive https://github.com/luvit/luvi.git
RUN apk add perl linux-headers
RUN make -C luvi regular-asm
RUN make -C luvi
FROM alpine AS build-lit
RUN apk add build-base cmake git
COPY --from=build-luvi /luvi/build/luvi /usr/bin/luvi
RUN echo "#!/usr/bin/luvi --" > prefix
RUN git clone --recursive https://github.com/luvit/lit.git
RUN /usr/bin/luvi lit -- make lit /usr/bin/lit prefix
FROM alpine AS build-luvit
RUN apk add build-base cmake git
COPY --from=build-luvi /luvi/build/luvi /usr/bin/luvi
RUN echo "#!/usr/bin/luvi --" > prefix
COPY --from=build-lit /usr/bin/lit /usr/bin/lit
RUN git clone --recursive https://github.com/luvit/luvit.git
RUN /usr/bin/lit make luvit /usr/bin/luvit prefix
FROM alpine
RUN apk add luajit
COPY --from=build-luv /luvi/deps/luv/build/luv.so /usr/lib/lua/5.1/luv.so
COPY --from=build-luvit /usr/bin/luvi /usr/bin/luvi
COPY --from=build-luvit /usr/bin/lit /usr/bin/lit
COPY --from=build-luvit /usr/bin/luvit /usr/bin/luvit
CMD ["/usr/bin/luvit"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment