diff --git a/DOCKER_BUILD.md b/DOCKER_BUILD.md new file mode 100644 index 0000000..59e3b87 --- /dev/null +++ b/DOCKER_BUILD.md @@ -0,0 +1,19 @@ +## Build using Docker + +Build: + +```bash +docker build -t lua-resty-http-builder:test . +``` + +Run: + +```bash +docker run --rm -it -v "$(pwd)":/src -w /src lua-resty-http-builder:test bash + +# Check LUA as well as run all tests and coverage: +luacheck lib && make coverage + +# Run a single test file: +luacheck lib && TEST_FILE=t/01-basic.t make coverage +``` diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..487f912 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM openresty/openresty:1.29.2.2-alpine-fat + +RUN apk add --no-cache curl perl bash wget git perl-dev libarchive-tools nodejs; \ + ln -s /usr/bin/bsdtar /usr/bin/tar + +RUN curl -s -L https://cpanmin.us | perl - App::cpanminus > /bin/cpanm && chmod +x /bin/cpanm + +RUN cpanm -q -n Test::Nginx + +RUN /usr/local/openresty/luajit/bin/luarocks install luacov && \ + /usr/local/openresty/luajit/bin/luarocks install lua-resty-openssl && \ + /usr/local/openresty/luajit/bin/luarocks install luacheck