Building from Packages (DEB, RPM, APK)

These Dockerfiles use the official OpenResty package repositories to install a pre-compiled version of OpenResty. While they offer less customization than building from source, you can still use them as a base for your own images to add applications, tools, and configurations.

DEB-based (Debian/Ubuntu)

Flavors like bookworm and bullseye use the OpenResty APT repository.

Example

To build the standard bookworm image:

git clone https://github.com/openresty/docker-openresty.git
cd docker-openresty
docker build -f bookworm/Dockerfile .

DEB Build Arguments

Key Default Description
RESTY_APT_REPO "https://openresty.org/package/debian" Apt repo to load from.
RESTY_APT_PGP "https://openresty.org/package/pubkey.gpg" URL to download APT PGP key from.
RESTY_APT_ARCH "amd64" Architecture for APT lookups.
RESTY_IMAGE_BASE "debian" The Debian Docker image base to build FROM.
RESTY_IMAGE_TAG "bullseye-slim" The Debian Docker image tag to build FROM.
RESTY_DEB_FLAVOR "" The package flavor to use (e.g., "-debug", "-valgrind").
RESTY_DEB_VERSION "=1.27.1.2-1~bookworm1" The Debian package version to install.

RPM-based (CentOS/Fedora/Rocky)

Flavors like centos, centos7, fedora, and rocky use the OpenResty YUM/DNF repository.

Example

To build a rockylinux based image:

docker build -f fedora/Dockerfile \
  --build-arg RESTY_IMAGE_BASE=rockylinux \
  --build-arg RESTY_IMAGE_TAG=8.5 \
  --build-arg RESTY_YUM_REPO="https://openresty.org/package/rocky/openresty.repo" \
  --build-arg RESTY_RPM_DIST="el8" \
  -t my-rocky-openresty .

RPM Build Arguments

Key Default Description
RESTY_IMAGE_BASE "centos" The base Docker image to build FROM.
RESTY_IMAGE_TAG "8" The base Docker image tag to build FROM.
RESTY_YUM_REPO "https://openresty.org/package/centos/openresty.repo" URL for the OpenResty YUM Repository.
RESTY_RPM_FLAVOR "" The package flavor to use (e.g., "-debug").
RESTY_RPM_VERSION "1.27.1.2-1" The package version to install.
RESTY_RPM_DIST "el8" The package distribution to install.
RESTY_RPM_ARCH "x86_64" The package architecture to install.

APK-based (Alpine)

The alpine-apk flavor uses the OpenResty APK repository for Alpine Linux.

Example

docker build -f alpine-apk/Dockerfile .

APK Build Arguments

Key Default Description
RESTY_IMAGE_BASE "alpine" The Alpine Docker image base to build FROM.
RESTY_IMAGE_TAG "3.18.12" The Alpine Docker image tag to build FROM.
RESTY_APK_ALPINE_VERSION "3.18" The Alpine version for the repository URL.
RESTY_APK_KEY_URL "https://..." The URL of the signing key for the package.
RESTY_APK_REPO_URL "https://..." The URL of the APK repository.
RESTY_APK_VERSION "=1.27.1.2-r0" The package version suffix to install.