FROM nickblah/lua:5.4-luarocks-alpine AS build-env

WORKDIR /build
RUN apk add --no-cache build-base git cmark-dev
RUN luarocks install moonscript && \
    luarocks install ldoc && \
    luarocks install cmark

COPY . /build/
RUN make docs

FROM nginx:alpine
COPY --from=build-env /build/docs /usr/share/nginx/html
RUN chmod 555 -R /usr/share/nginx/html
