-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: now building ngx_http_redis_module.so on nginx image build (#137)
- Loading branch information
Showing
4 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
FROM nginx:1.20.2-alpine | ||
# Build arguments | ||
ARG NGINX_VERSION=1.20.2 | ||
ARG NGX_HTTP_REDIS_VERSION=0.3.8 | ||
|
||
# Copy specific configuration files and libraries | ||
FROM nginx:${NGINX_VERSION}-alpine | ||
|
||
# Environment variables | ||
ARG NGINX_VERSION | ||
ENV NGINX_VERSION=${NGINX_VERSION} | ||
ARG NGX_HTTP_REDIS_VERSION | ||
ENV NGX_HTTP_REDIS_VERSION=${NGX_HTTP_REDIS_VERSION} | ||
|
||
# Copy specific configuration files | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY ngx_http_redis_module.so /usr/lib/nginx/modules/ngx_http_redis_module.so | ||
COPY overfast-api.conf /etc/nginx/conf.d/default.conf | ||
COPY overfast-api.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Download nginx and ngx_http_redis sources | ||
RUN wget https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ | ||
tar -xzvf nginx-$NGINX_VERSION.tar.gz && \ | ||
wget http://people.freebsd.org/~osa/ngx_http_redis-$NGX_HTTP_REDIS_VERSION.tar.gz && \ | ||
tar -xzvf ngx_http_redis-$NGX_HTTP_REDIS_VERSION.tar.gz | ||
|
||
# Download build dependencies | ||
RUN apk add build-base linux-headers pcre-dev openssl-dev zlib-dev | ||
|
||
# Configure nginx with ngx_http_redis module. We must use the same configuration | ||
# settings than the ones used in nginx compilation. We then only build the | ||
# modules, and copy the resulting ngx_http_redis_module.so into nginx modules directory | ||
RUN cd nginx-$NGINX_VERSION && \ | ||
nginx_configure_args=$(nginx -V 2>&1 | grep 'configure arguments:' | sed -e "s/configure arguments://") && \ | ||
echo "./configure $nginx_configure_args --add-dynamic-module=../ngx_http_redis-$NGX_HTTP_REDIS_VERSION" > configure.sh && \ | ||
chmod +x configure.sh && \ | ||
./configure.sh && \ | ||
make modules && \ | ||
cp objs/ngx_http_redis_module.so /usr/lib/nginx/modules/ngx_http_redis_module.so | ||
|
||
# Clean everything | ||
RUN rm -rf nginx-$NGINX_VERSION* && \ | ||
rm -rf ngx_http_redis-$NGX_HTTP_REDIS_VERSION* |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters