From 9bee9223ac19107cc8e199f1cbfd4de1b525a6b0 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 12 Sep 2021 03:19:30 -0500 Subject: [PATCH] docker: add openresty to base image. Include OpenResty in the base Docker image. This is so we can run OpenResty in front of Danbooru as a reverse proxy to serve static assets (CSS, JS, and static images living in public/images). Including the proxy in the same container as the static assets avoids a lot of problems with trying to share files across separate containers. --- config/docker/build-base-image.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/docker/build-base-image.sh b/config/docker/build-base-image.sh index ddc5a6758..944641c9a 100755 --- a/config/docker/build-base-image.sh +++ b/config/docker/build-base-image.sh @@ -6,6 +6,7 @@ RUBY_VERSION="${RUBY_VERSION:-2.7.1}" VIPS_VERSION="${VIPS_VERSION:-8.10.6}" FFMPEG_VERSION="${FFMPEG_VERSION:-4.3.2}" EXIFTOOL_VERSION="${EXIFTOOL_VERSION:-12.30}" +OPENRESTY_VERSION="${OPENRESTY_VERSION:-1.19.9.1}" COMMON_BUILD_DEPS=" curl ca-certificates build-essential pkg-config git @@ -84,6 +85,23 @@ install_ruby() { ruby --version } +install_openresty() { + apt_install libpcre++-dev + + OPENRESTY_URL="https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz" + curl -L "$OPENRESTY_URL" | tar -C /usr/local/src -xzvf - + cd /usr/local/src/openresty-${OPENRESTY_VERSION} + + # https://github.com/openresty/docker-openresty/blob/master/alpine/Dockerfile + ./configure -j$(nproc) --prefix=/usr/local \ + --with-threads --with-compat --with-pcre-jit --with-file-aio \ + --with-http_gunzip_module --with-http_gzip_static_module \ + --with-http_realip_module --with-http_ssl_module \ + --with-http_stub_status_module --with-http_v2_module + make -j $(nproc) + make install +} + install_busybox() { busybox --install -s } @@ -114,5 +132,6 @@ install_exiftool install_ffmpeg install_vips install_ruby +install_openresty cleanup install_busybox # after cleanup so we can install some utils removed by cleanup