容量管理: zones.rs 直读 nginx file_cache 共享内存记账(双轴: 磁盘 + keys_zone 索引内存), ?scan=1 扫盘上限 20 万文件; POST /api/admin/cache/purge 整区清理(只删文件不删目录, 根治 [crit] mkdir failed); POST /api/admin/cache/invalidate 按制品精准失效(预览->确认两步式, glob/子串, 删除上限 5000/扫描上限 20 万); GET /api/admin/cache 新增 capacity 块; 前端容量面板 + 按制品失效工具条; 测试 test-cache-capacity.sh 48/48(容量 27 + 精准失效 21, 含 EXPECT_MIN 护栏与前端静态契约); docs 容量管理章节
52 lines
1.5 KiB
Docker
52 lines
1.5 KiB
Docker
ARG NGX_VERSION=1.30.4
|
|
# NGINX official images are available for one specific release of Debian,
|
|
# e.g `nginx:1.30.4-trixie`. Please see the list of tags on Docker Hub
|
|
# if you need to change NGX_VERSION.
|
|
ARG DEBIAN_RELEASE=trixie
|
|
|
|
# --- builder: build all examples
|
|
FROM rust:slim-${DEBIAN_RELEASE} AS build
|
|
ARG NGX_VERSION
|
|
ARG NGX_CONFIGURE_ARGS=
|
|
WORKDIR /project
|
|
RUN --mount=type=cache,target=/var/cache/apt <<EOF
|
|
set -eux
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get -qq update
|
|
apt-get -qq install --yes --no-install-recommends --no-install-suggests \
|
|
libclang-dev \
|
|
libpcre2-dev \
|
|
libssl-dev \
|
|
zlib1g-dev \
|
|
pkg-config \
|
|
git \
|
|
grep \
|
|
gawk \
|
|
gnupg2 \
|
|
sed \
|
|
make
|
|
git config --global --add safe.directory /project
|
|
EOF
|
|
|
|
COPY . .
|
|
|
|
RUN --mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
|
|
cargo fetch --locked
|
|
|
|
RUN --mount=type=cache,id=target,target=target \
|
|
--mount=type=cache,id=cache,target=.cache \
|
|
--mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
|
|
mkdir -p /out && \
|
|
cargo build --release --package examples --examples && \
|
|
mv /project/target/release/examples/*.so /out
|
|
|
|
# --- copy dynamic modules into official nginx image from builderclear
|
|
FROM nginx:${NGX_VERSION}-${DEBIAN_RELEASE}
|
|
|
|
RUN mkdir -p /etc/nginx/examples
|
|
|
|
COPY --from=build /out/*.so /etc/nginx/modules/
|
|
COPY --from=build /project/examples/*.conf /etc/nginx/examples
|
|
|
|
EXPOSE 8000
|