Last active
April 29, 2025 06:04
-
-
Save a-h-abid/1810a64a2d0c7d9fef81a35cc7af6cc9 to your computer and use it in GitHub Desktop.
Nginx v1.17.6 modules building for CentOS / RHEL 6
This file contains hidden or 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
FROM centos:6.10 | |
# Update to use vault repositories since CentOS 6 is EOL | |
RUN sed -i 's|mirrorlist=http://mirrorlist.centos.org|#mirrorlist=http://mirrorlist.centos.org|g' /etc/yum.repos.d/CentOS-Base.repo && \ | |
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Base.repo | |
# Clean and update yum | |
RUN yum clean all && yum -y update | |
# Install build dependencies | |
RUN yum install -y gcc make curl tar pcre-devel zlib-devel openssl-devel | |
# Download and extract the same nginx version as the target system | |
WORKDIR /build | |
RUN curl -O http://nginx.org/download/nginx-1.17.6.tar.gz && \ | |
tar -xf nginx-1.17.6.tar.gz | |
# Download and extract a specific version of njs that's compatible with NGINX 1.17.6 | |
RUN curl -O http://hg.nginx.org/njs/archive/0.3.8.tar.gz && \ | |
tar -xf 0.3.8.tar.gz | |
# Configure and build with minimal modules to avoid dependency issues | |
WORKDIR /build/nginx-1.17.6 | |
RUN ./configure --with-compat \ | |
--add-dynamic-module=../njs-0.3.8/nginx | |
# Build just the modules (not the full nginx) | |
RUN make modules | |
# The module will be in /build/nginx-1.17.6/objs/ngx_http_js_module.so | |
# Create a directory to hold the final artifact | |
RUN mkdir -p /output && \ | |
cp /build/nginx-1.17.6/objs/ngx_http_js_module.so /output/ | |
# Set the working directory to the output directory for easier extraction | |
WORKDIR /output | |
# The module can be extracted from the container using: | |
# docker cp container_id:/output/ngx_http_js_module.so /path/on/host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment