Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ jobs:
matrix:
nginx:
- "1.26.3"
- "1.30.2"
flavor:
- tsuru
openresty_package_version:
- 1.27.1.1-1~bookworm1
experimental:
- false

Expand All @@ -29,6 +28,7 @@ jobs:
- run: |
echo MODULES=$(jq -er '.flavors[] | select(.name == "${{ matrix.flavor }}") | .modules | join(",")' flavors.json) >> $GITHUB_ENV
echo LUA_MODULES=$(jq -er '.flavors[] | select(.name == "${{ matrix.flavor }}") | [ .lua_modules[]? ] | join(",")' flavors.json) >> $GITHUB_ENV
echo LOCAL_TAG=tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }} >> $GITHUB_ENV
if [[ "${{ github.ref }}" == "refs/heads/main" ]] || [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo DOCKER_TAGS=tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }},tsuru/nginx-${{ matrix.flavor }}:${{ matrix.nginx }}-${GITHUB_REF##*/} >> $GITHUB_ENV
else
Expand All @@ -37,12 +37,11 @@ jobs:
- uses: docker/build-push-action@v4
with:
load: true
tags: ${{ env.DOCKER_TAGS }}
tags: ${{ env.LOCAL_TAG }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
nginx_version=${{ matrix.nginx }}
openresty_package_version=${{ matrix.openresty_package_version }}
modules=${{ env.MODULES }}
lua_modules=${{ env.LUA_MODULES }}
- run: make test flavor=${{ matrix.flavor }} nginx_version=${{ matrix.nginx }}
Expand Down
31 changes: 17 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
ARG nginx_version=stable

FROM openresty/openresty:1.31.1.1-restyrepo AS openresty

FROM nginx:${nginx_version} AS build

SHELL ["/bin/bash", "-c"]

RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-suggests \
libluajit-5.1-dev libpam0g-dev zlib1g-dev libpcre3-dev libpcre2-dev \
libexpat1-dev git curl build-essential lsb-release libxml2 libxslt1.1 libxslt1-dev autoconf libtool libssl-dev \
unzip libmaxminddb-dev libbrotli-dev cmake pkg-config libjansson-dev
libpam0g-dev zlib1g-dev libpcre2-dev \
libexpat1-dev git curl build-essential libxml2 libxslt1.1 libxslt1-dev autoconf libtool libssl-dev \
unzip libmaxminddb-dev libbrotli-dev cmake pkg-config libjansson-dev \
&& if [ "${NGINX_VERSION}" = "1.26.3" ]; then apt-get install -y --no-install-suggests libpcre3-dev; fi

RUN git clone --depth 1 --branch cpp-3.1.0 https://github.com/msgpack/msgpack-c.git /home/msgpack
RUN cd /home/msgpack \
Expand All @@ -21,17 +25,16 @@ RUN mkdir -p /home/libjwt/build && \
cd /home/libjwt/build && \
cmake .. && make && make install

ARG openresty_package_version=1.27.1.1-1~bookworm1
RUN set -x \
&& curl -fsSL https://openresty.org/package/pubkey.gpg | apt-key add - \
&& echo "deb https://openresty.org/package/$(uname -m | grep -qE 'aarch64|arm64' && echo -n 'arm64/')debian $(lsb_release -sc) openresty" | tee -a /etc/apt/sources.list.d/openresty.list \
&& apt-get update \
&& apt-get install -y --no-install-suggests openresty=${openresty_package_version} \
&& cd /usr/local/openresty \
&& cp -vr ./luajit/* /usr/local/ \
&& rm -d /usr/local/share/lua/5.1 \
&& ln -sf /usr/local/lib/lua/5.1 /usr/local/share/lua/ \
&& cp -vr ./lualib/* /usr/local/lib/lua/5.1
RUN git clone --depth 1 https://github.com/openresty/luajit2.git /home/luajit2 \
&& cd /home/luajit2 \
&& make -j$(nproc) PREFIX=/usr/local \
&& make install PREFIX=/usr/local \
&& rm -rf /home/luajit2

COPY --from=openresty /usr/local/openresty/lualib/ /usr/local/lib/lua/5.1/
RUN mkdir -p /usr/local/share/lua \
&& rm -rf /usr/local/share/lua/5.1 \
&& ln -sf /usr/local/lib/lua/5.1 /usr/local/share/lua/

ENV LUAJIT_LIB=/usr/local/lib \
LUAJIT_INC=/usr/local/include/luajit-2.1
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ test: check-required-vars

$(DOCKER) start test-tsuru-nginx-$(flavor)-$(nginx_version) && sleep 3

$(DOCKER) exec test-tsuru-nginx-$(flavor)-$(nginx_version) sh -c '/bin/test-nginx; exit $$?' || $(DOCKER) logs test-tsuru-nginx-$(flavor)-$(nginx_version)
$(DOCKER) inspect --format='{{.State.Running}}' test-tsuru-nginx-$(flavor)-$(nginx_version) | grep -q true || \
(echo "Container failed to start:" && $(DOCKER) logs test-tsuru-nginx-$(flavor)-$(nginx_version) && exit 1)

$(DOCKER) exec test-tsuru-nginx-$(flavor)-$(nginx_version) sh -c '/bin/test-nginx; exit $$?' || \
($(DOCKER) logs test-tsuru-nginx-$(flavor)-$(nginx_version) && exit 1)
2 changes: 1 addition & 1 deletion flavors.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "tsuru",
"modules": [
"https://github.com/simplresty/ngx_devel_kit.git:v0.3.1",
"https://github.com/openresty/lua-nginx-module.git:v0.10.27",
"https://github.com/openresty/lua-nginx-module.git:v0.10.31",
"https://github.com/openresty/lua-ssl-nginx-module.git",
"https://github.com/openresty/echo-nginx-module.git",
"https://github.com/openresty/headers-more-nginx-module.git",
Expand Down
2 changes: 1 addition & 1 deletion test/nginx-tsuru.conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ http {
return
end

ngx.say(cjson.encode({proxied = true, body=res.body}))
ngx.say(string.format('{"body":%s,"proxied":true}', cjson.encode(res.body)))

}
}
Expand Down
Loading