Sign inSign up

mineunit/luacheck

By mineunit

•Updated over 2 years ago

Image
0

811

mineunit/luacheck repository overview

⁠Buckaroo's luacheck for minetest

https://github.com/BuckarooBanzay/luacheck/tree/minetest-builtin⁠

Default workdir is /repo (mount your lua files here).

Default user is root but there's also normal user named luacheck which you can use if you like.

Default command line is "luacheck --std minetest+max --config .luacheckrc .".

To run it in current directory (your minetest mod directory where .luacheckrc config file is):

docker run --rm -it -u luacheck --mount="type=bind,readonly,source=$(pwd),target=/repo" mineunit/luacheck

You can override command line starting from --config with anything supplied for docker run, to remove default --config .luacherc you can do this:

docker run --rm -it -u luacheck --mount="type=bind,readonly,source=$(pwd),target=/repo" mineunit/luacheck .

⁠Convenience helper for manual commad line execution

File: ~/bin/luacheck-mt With contents:

#!/bin/bash
docker run --rm -it -u luacheck --mount="type=bind,readonly,source=$(pwd),target=/repo" mineunit/luacheck "${@}"

Mark it executable with chmod +x ~/bin/luacheck-mt and then you can just do luacheck-mt [any args you might need] in shell and it'll mount cwd to execute luacheck against it in container.

⁠Dockerfile

FROM alpine:latest as base

USER root
ENV USER=root

# Install required tools, Lua, luasocket and luacov
RUN apk add --no-cache build-base git luarocks5.1 lua5.1-sec

# I'm so sorry about this but I believe you can handle it
RUN rm -fv /usr/bin/lua /usr/bin/luac /usr/bin/luac5.1 /usr/bin/lua5.1 \
	&& ln -sT luajit /usr/bin/lua \
	&& ln -sT luajit /usr/bin/lua5.1 \
	&& ln -sT luajit /usr/bin/luac5.1 \
	&& ln -sT luajit /usr/bin/luac \
	&& apk del --no-cache -f lua-dev \
	&& apk add --no-cache luajit luajit-dev

################################
# Build
FROM base as build

# Build and install luacheck
RUN mkdir /build \
	&& cd /build \
	&& git clone --depth 1 --branch minetest-builtin https://github.com/BuckarooBanzay/luacheck.git \
	&& cd luacheck \
	&& luarocks-5.1 make

################################
# Cleanup
FROM alpine:latest

COPY --from=build /usr/local /usr/local

# Just nice to have but wont be default
RUN adduser -D luacheck

# Stuff needed to actually run it
RUN apk add --no-cache luajit
RUN ln -sT /usr/bin/luajit /usr/bin/lua5.1
RUN ln -sT /usr/bin/luajit /usr/bin/lua

WORKDIR /repo
ENTRYPOINT ["luacheck", "--std", "minetest+max"]
CMD ["--config", ".luacheckrc", "."]

Tag summary

Content type

Image

Digest

sha256:c63facd26…

Size

4.1 MB

Last updated

over 2 years ago

docker pull mineunit/luacheck