Skip to content

Commit b92d324

Browse files
authored
feat: docker build: Add DOCKER_BUILD.md and Dockerfile (#341)
Take the parts from `.github/workflows/test.yml` needed to do full testing with running `luacheck`, the tests, and coverage. Use a recent OpenResty 1.29.2.4 Docker image. Show all steps needed for interactive development in `DOCKER_BUILD.md`. Also show how to run a single test with `t/01-basic.t` as example.
1 parent f673dd9 commit b92d324

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

DOCKER_BUILD.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Build using Docker
2+
3+
Build:
4+
5+
```bash
6+
docker build -t lua-resty-http-builder:test .
7+
```
8+
9+
Run:
10+
11+
```bash
12+
docker run --rm -it -v "$(pwd)":/src -w /src lua-resty-http-builder:test bash
13+
14+
# Check LUA as well as run all tests and coverage:
15+
luacheck lib && make coverage
16+
17+
# Run a single test file:
18+
luacheck lib && TEST_FILE=t/01-basic.t make coverage
19+
```

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM openresty/openresty:1.29.2.4-alpine-fat
2+
3+
RUN apk add --no-cache curl perl bash wget git perl-dev libarchive-tools nodejs; \
4+
ln -s /usr/bin/bsdtar /usr/bin/tar
5+
6+
RUN curl -s -L https://cpanmin.us | perl - App::cpanminus > /bin/cpanm && chmod +x /bin/cpanm
7+
8+
RUN cpanm -q -n Test::Nginx
9+
10+
RUN /usr/local/openresty/luajit/bin/luarocks install luacov && \
11+
/usr/local/openresty/luajit/bin/luarocks install lua-resty-openssl && \
12+
/usr/local/openresty/luajit/bin/luarocks install luacheck

0 commit comments

Comments
 (0)