Skip to content

Commit

Permalink
linting + fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocicerchia committed Dec 16, 2021
1 parent 8baee91 commit e2b6cf5
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 28 deletions.
29 changes: 5 additions & 24 deletions Dockerfile-compat
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ ARG EXTENDED_IMAGE=1
ENV EXTENDED_IMAGE=$EXTENDED_IMAGE

# lua
ARG VER_LUA=5.4
ARG VER_LUA=5.4.3
ENV VER_LUA=$VER_LUA

ENV MYCFLAGS=" -DLUA_COMPAT_5_1"
ENV LUA_INCDIR=/usr/local/include/luajit-2.1

# ngx_devel_kit
# https://github.com/vision5/ngx_devel_kit/releases
# The NDK is now considered to be stable.
Expand All @@ -48,6 +45,7 @@ ARG LUAJIT_LIB=/usr/local/lib
ENV LUAJIT_LIB=$LUAJIT_LIB
ARG LUAJIT_INC=/usr/local/include/luajit-2.1
ENV LUAJIT_INC=$LUAJIT_INC
ENV LUA_INCDIR=$LUAJIT_INC
ARG LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH

Expand Down Expand Up @@ -118,7 +116,7 @@ ENV VER_OPENRESTY_WEBSOCKET=$VER_OPENRESTY_WEBSOCKET

# lua-rocks
# https://luarocks.github.io/luarocks/releases/
ARG VER_LUAROCKS=3.7.0
ARG VER_LUAROCKS=3.8.0
ENV VER_LUAROCKS=$VER_LUAROCKS

# lua-upstream-nginx-module
Expand Down Expand Up @@ -237,25 +235,12 @@ RUN set -eux \
&& apk add --no-cache \
$BUILD_DEPS \
$NGINX_BUILD_DEPS \
&& curl -R -O http://www.lua.org/ftp/lua-5.4.3.tar.gz \
&& tar zxf lua-5.4.3.tar.gz \
&& cd lua-5.4.3 \
#&& sed -i "s/MYCFLAGS=.*/MYCFLAGS=$MYCFLAGS/" src/Makefile \
&& sed -i "s/DLUA_COMPAT_5_3/DLUA_COMPAT_5_1/" src/Makefile \
&& make all test && make install \
&& cd .. \
&& curl -L -O https://luarocks.org/releases/luarocks-3.8.0.tar.gz \
&& tar zxpf luarocks-3.8.0.tar.gz \
&& cd luarocks-3.8.0 \
&& ./configure --with-lua-include=/usr/local/include \
&& make \
&& make install \
&& cd .. \
&& [ $EXTENDED_IMAGE -eq 1 ] && \
NGINX_BUILD_CONFIG="${NGINX_BUILD_CONFIG} \
--add-module=/headers-more-nginx-module-${VER_OPENRESTY_HEADERS} \
--add-module=/stream-lua-nginx-module-${VER_OPENRESTY_STREAMLUA} \
" \
&& make -j "$(nproc)" lua-src \
&& make -j "$(nproc)" deps \
&& make -j "$(nproc)" core \
&& make -j "$(nproc)" luarocks
Expand Down Expand Up @@ -301,8 +286,6 @@ LABEL maintainer="Fabio Cicerchia <[email protected]>" \

ARG PKG_DEPS="\
geoip-dev \
lua${VER_LUA} \
lua${VER_LUA}-dev \
openssl-dev \
pcre-dev \
unzip \
Expand All @@ -320,7 +303,7 @@ COPY --from=builder /usr/local/bin/lua /usr/local/bin/lua
COPY --from=builder /usr/local/bin/luajit /usr/local/bin/luajit
COPY --from=builder /usr/local/bin/luarocks /usr/local/bin/luarocks
COPY --from=builder /usr/local/etc/luarocks /usr/local/etc/luarocks
COPY --from=builder /usr/local/include/luajit-2.1 /usr/local/include/luajit-2.1
COPY --from=builder $LUAJIT_INC $LUAJIT_INC

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]

Expand All @@ -329,8 +312,6 @@ RUN set -eux \
&& apk update \
&& apk add --no-cache --virtual .pkg_deps \
$PKG_DEPS \
# Fix LUA alias
#&& ln -sf /usr/bin/lua${VER_LUA} /usr/local/bin/lua \
# Bring in gettext so we can get `envsubst`, then throw
# the rest away. To do this, we need to install `gettext`
# then move `envsubst` out of the way so `gettext` can
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ Provides Nginx + Lua + extra lua modules. Uses Alpine, Amazon Linux, Debian, Fed

Provides Nginx + Lua + extra lua modules. Uses pinned version for Alpine, Amazon Linux, Debian, Fedora, Ubuntu for base image. Enables LUA 5.1 Compatibility.
**WARNING:** This version has a compiled version of LUA and not using the version distributed by the OS's packet manager.

### `fabiocicerchia/nginx-lua:<version>-minimal`

Provides Nginx + Lua image. Uses Alpine for base image.
Expand Down
4 changes: 2 additions & 2 deletions bin/generate-dockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function init_dockerfile() {
mkdir -p "$DOCKERFILE_PATH" 2>/dev/null
cp "tpl/Dockerfile.$OS" "$DOCKERFILE"

patch_dockerfile $DOCKERFILE
patch_dockerfile "$DOCKERFILE"
}

function init_dockerfile_compat() {
Expand All @@ -37,7 +37,7 @@ function init_dockerfile_compat() {
mkdir -p "$DOCKERFILE_PATH" 2>/dev/null
cp "tpl/Dockerfile.$OS-compat" "$DOCKERFILE"

patch_dockerfile $DOCKERFILE
patch_dockerfile "$DOCKERFILE"
}

set -eux
Expand Down
2 changes: 1 addition & 1 deletion nginx/1.21.4/amazonlinux/2.0.20211201.0/Dockerfile-compat
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ RUN set -eux \
&& make -j "$(nproc)" lua-src \
&& make -j "$(nproc)" deps \
&& make -j "$(nproc)" core \
&& make -j "$(nproc)" luarocks
&& make -j "$(nproc)" luarocks \
&& yum clean all \
&& rm -rf /var/cache/yum

Expand Down
2 changes: 2 additions & 0 deletions nginx/1.21.4/fedora/35/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ COPY --from=builder /usr/sbin/nginx /usr/sbin/nginx
COPY --from=builder /usr/sbin/nginx-debug /usr/sbin/nginx-debug
COPY --from=builder /var/cache/nginx /var/cache/nginx
COPY --from=builder /usr/bin/envsubst /usr/local/bin/envsubst
COPY --from=builder /usr/local/bin/luarocks /usr/local/bin/luarocks
COPY --from=builder /usr/local/etc/luarocks /usr/local/etc/luarocks

SHELL ["/bin/sh", "-o", "pipefail", "-c"]

Expand Down
2 changes: 1 addition & 1 deletion tpl/Dockerfile.amazonlinux-compat
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ RUN set -eux \
&& make -j "$(nproc)" lua-src \
&& make -j "$(nproc)" deps \
&& make -j "$(nproc)" core \
&& make -j "$(nproc)" luarocks
&& make -j "$(nproc)" luarocks \
&& yum clean all \
&& rm -rf /var/cache/yum

Expand Down
2 changes: 2 additions & 0 deletions tpl/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ COPY --from=builder /usr/sbin/nginx /usr/sbin/nginx
COPY --from=builder /usr/sbin/nginx-debug /usr/sbin/nginx-debug
COPY --from=builder /var/cache/nginx /var/cache/nginx
COPY --from=builder /usr/bin/envsubst /usr/local/bin/envsubst
COPY --from=builder /usr/local/bin/luarocks /usr/local/bin/luarocks
COPY --from=builder /usr/local/etc/luarocks /usr/local/etc/luarocks

SHELL ["/bin/sh", "-o", "pipefail", "-c"]

Expand Down

0 comments on commit e2b6cf5

Please sign in to comment.