Sign inSign up

sungyism/openresty

By sungyism

•Updated 3 months ago

Image
0

1.2K

sungyism/openresty repository overview

⁠OpenResty Docker Image

A high-performance, source-compiled OpenResty Docker image built on Enterprise Linux, featuring additional nginx modules, optimized libraries, and extended Lua libraries for modern web applications and API gateways.

Docker Build Docker Pulls License

⁠Requirements

Important: This image requires Enterprise Linux 9 or later as the base OS, including:

  • Rocky Linux 9 / 10
  • AlmaLinux 9 / 10
  • CentOS Stream 9 / 10
  • Red Hat Enterprise Linux 9 / 10

EL8 and earlier versions are not supported.

⁠Features

  • Source-compiled - All components built from source with optimized compiler flags
  • Multi-stage build - Minimal runtime image size without build dependencies
  • Multi-platform - Supports linux/amd64 and linux/arm64 architectures
  • Modern TLS - OpenSSL 3.x with OpenResty-specific patches for yield support
  • Brotli compression - Native support for Brotli encoding
  • GeoIP2 - MaxMind GeoIP2 integration for geolocation
  • Enhanced Lua - Additional Lua libraries for routing, IP matching, and expression evaluation

⁠Quick Start

# Pull from Docker Hub
docker pull sungyism/openresty:latest

# Run a basic container
docker run -d --name openresty \
  -p 80:80 \
  sungyism/openresty:latest

# Verify
curl http://localhost/

⁠Usage

⁠Basic Usage
docker run -d --name openresty \
  -p 80:80 \
  -p 443:443 \
  sungyism/openresty:latest
⁠With Custom Configuration
docker run -d --name openresty \
  -p 80:80 \
  -p 443:443 \
  -v /path/to/nginx.conf:/etc/nginx/nginx.conf:ro \
  -v /path/to/conf.d:/etc/nginx/conf.d:ro \
  -v /path/to/certs:/etc/nginx/certs:ro \
  -v /path/to/html:/opt/openresty/nginx/html:ro \
  sungyism/openresty:latest
⁠Docker Compose
version: '3.8'

services:
  openresty:
    image: sungyism/openresty:latest
    container_name: openresty
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - ./conf.d:/etc/nginx/conf.d:ro
      - ./html:/opt/openresty/nginx/html:ro
      - ./logs:/var/log/nginx
    environment:
      - NGINX_ENTRYPOINT_QUIET_LOGS=1

⁠Building from Source

⁠Default Build (Rocky Linux 9)
docker build -t openresty:local .
⁠Build with Proxy

If you are behind a corporate firewall or have network restrictions, you can pass proxy settings:

# Using environment variables (recommended)
docker build \
  --build-arg HTTP_PROXY=${HTTP_PROXY} \
  --build-arg HTTPS_PROXY=${HTTPS_PROXY} \
  --build-arg NO_PROXY=${NO_PROXY} \
  -t openresty:local .

# Or with explicit proxy values
docker build \
  --build-arg HTTP_PROXY=http://proxy.example.com:8080 \
  --build-arg HTTPS_PROXY=http://proxy.example.com:8080 \
  --build-arg NO_PROXY=localhost,127.0.0.1,.internal \
  -t openresty:local .
⁠Custom Base Image
# Rocky Linux 10
docker build \
  --build-arg BASE_IMAGE=rockylinux/rockylinux:10 \
  --build-arg RUNTIME_IMAGE=rockylinux/rockylinux:10-minimal \
  -t openresty:local .

# AlmaLinux 9
docker build \
  --build-arg BASE_IMAGE=almalinux:9 \
  --build-arg RUNTIME_IMAGE=almalinux:9-minimal \
  -t openresty:local .
⁠Multi-platform Build
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t openresty:local \
  .

⁠Build Arguments

ArgumentDefaultDescription
BASE_IMAGErockylinux/rockylinux:9Base image for download and build stages
RUNTIME_IMAGErockylinux/rockylinux:9-minimalBase image for final runtime stage
HTTP_PROXY(none)HTTP proxy for network requests
HTTPS_PROXY(none)HTTPS proxy for network requests
NO_PROXY(none)Hosts to bypass proxy
OPENRESTY_VER1.29.2.2OpenResty version
OPENSSL_VER3.5.5OpenSSL version
ZLIB_VER1.3.2zlib compression library version
PCRE2_VER10.47PCRE2 regex library version
GEOIP_VER1.6.12Legacy GeoIP library version
LIBMAXMINDDB_VER1.13.3MaxMind DB reader library version
BROTLI_VER1.2.0Brotli compression library version
NGX_BROTLI_VERmasternginx Brotli module version
NGX_GEOIP2_VER3.4nginx GeoIP2 module version
RESTY_EXPR_VER1.3.2lua-resty-expr version
RESTY_HTTP_VER0.2.3lua-resty-http version
RESTY_IPMATCHER_VER0.6.1lua-resty-ipmatcher version
RESTY_RADIXTREE_VER2.9.2lua-resty-radixtree version

⁠Included Components

⁠Core
ComponentDescription
OpenRestyFull-fledged web platform with LuaJIT
LuaJITJust-In-Time compiler for Lua with Lua 5.2 compatibility
OpenSSL 3.xTLS/SSL library with OpenResty session yield patch
zlibGeneral-purpose lossless compression library
PCRE2Perl-compatible regular expressions with JIT enabled
⁠Nginx Modules
ModuleDescription
ngx_brotliBrotli compression filter module
ngx_http_geoip2_moduleGeoIP2 country/city lookup using MaxMind databases
ngx_http_ssl_moduleHTTPS/TLS support
ngx_http_v2_moduleHTTP/2 support
ngx_http_v3_moduleHTTP/3 (QUIC) support
ngx_http_realip_moduleClient real IP extraction
ngx_http_image_filter_moduleImage transformation
ngx_http_xslt_moduleXSLT transformations
ngx_stream_moduleTCP/UDP proxying
⁠Lua Libraries
LibraryDescription
lua-resty-exprExpression evaluator for complex rule matching
lua-resty-httpHTTP client library for OpenResty
lua-resty-ipmatcherHigh-performance IP/CIDR matching
lua-resty-radixtreeRadix tree implementation for efficient routing

⁠Directory Structure

PathDescription
/etc/nginxConfiguration directory
/etc/nginx/nginx.confMain configuration file
/opt/openrestyOpenResty installation directory
/opt/openresty/lualibLua library path
/opt/openresty/nginxNginx server root
/var/log/nginxLog files
/var/lib/nginxRuntime data (temp files, client bodies)
/docker-entrypoint.dEntrypoint initialization scripts

⁠Environment Variables

VariableDescription
NGINX_ENTRYPOINT_QUIET_LOGSSet to suppress entrypoint log output
LUA_PATHLua module search path
LUA_CPATHLua C module search path
PATHIncludes OpenResty binaries

⁠Entrypoint Scripts

The container supports initialization scripts placed in /docker-entrypoint.d/:

  • *.sh files are executed on container startup
  • *.envsh files are sourced into the environment
  • Scripts must be executable (chmod +x)

Example initialization script:

#!/bin/sh
# /docker-entrypoint.d/10-init-lua.sh
echo "Initializing Lua cache..."
mkdir -p /var/lib/nginx/lua_cache

⁠Image Variants

Images are available on Docker Hub:

  • sungyism/openresty:latest - Latest stable build
  • sungyism/openresty:1.29.2.2 - Version-specific tag

⁠Security Considerations

  • Runs as non-root user openresty (UID 101) by default
  • Minimal runtime image reduces attack surface
  • Compiled with security-hardened flags
  • OpenSSL built with FIPS support enabled

⁠Performance Tuning

The image is built with optimizations:

  • -O3 compiler optimization level
  • Position-independent code (-fPIC)
  • PCRE2 with JIT enabled
  • LuaJIT with dual-number mode and Lua 5.2 compatibility

⁠Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

⁠License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

⁠AI-Driven Development

This project is maintained using Claude Code (claude.ai/code), Anthropic's AI-powered coding assistant. All code modifications, documentation updates, and maintenance tasks are orchestrated through AI-assisted development workflows.

This approach enables:

  • Rapid iteration - Faster response to updates and security patches
  • Consistent quality - Uniform coding standards and best practices
  • Comprehensive documentation - Thorough and well-structured project documentation
  • Continuous improvement - Regular updates and optimization of the build process

For transparency, all commit messages include Co-Authored-By attribution indicating AI assistance.

⁠Acknowledgments

⁠Maintainer

Maintained by iYism [email protected]⁠

Tag summary

Content type

Image

Digest

sha256:a844be418…

Size

88.4 MB

Last updated

3 months ago

docker pull sungyism/openresty