Pre-compress static assets to Brotli (.br) and Gzip (.gz) variants. Minimal, non-root, CI-friendly.
Base image: SUSE BCI Base
- Recursively scans your working directory (or supplied paths) for common static asset extensions.
- Emits sibling
.brand.gzfiles beside each source when the source is newer than existing precompressed outputs. - Operates safely in read-only-friendly environments by writing through temporary files before atomic renames.
- Ships with Brotli, gzip, and pigz CLIs so you can choose between single-threaded or multi-core gzip compression.
- Runs as a non-root user by default (UID/GID
65532:65532).
- Docker (or a compatible container runtime).
- A directory containing assets to compress, mounted at
/work.
- Default command:
precompress-static-assets. - No args: scans
/workrecursively. - With args: limits work to the provided files or directories (relative to
/work). - Automatically skips files whose extension is outside the configured allowlist and ignores existing
.gz/.brartifacts. - Timestamp-aware: only regenerates compressed outputs when the source file is newer or the outputs are missing.
BROTLI_QUALITY(default:11) — Brotli compression level (0–11).GZIP_LEVEL(default:9) — gzip/pigz compression level (1–9).PREFER_PIGZ(default: unset) — set to1to preferpigz(parallel gzip). Otherwise the script uses the stockgzipbinary.PIGZ_PROCESSES(default:0) — whenPREFER_PIGZ=1, controls the number of worker processes (0= auto).ASSET_EXTENSIONS— comma-separated list of extensions to compress (overrides defaults).ADDITIONAL_EXTENSIONS— comma-separated list appended to the defaults orASSET_EXTENSIONSlist.
Run this container during build or deploy to pre-generate Brotli/Gzip artifacts that can be served directly by your webserver or CDN (e.g., via try_files rules that prefer .br and .gz when present).
The container bundles a minimal toolkit to support asset workflows:
- brotli — reference Brotli encoder.
- gzip — GNU gzip CLI.
- pigz — parallel gzip encoder for multi-core environments.
- find / gawk — used internally to discover assets and handle timestamp comparisons.
Use publish-asset-compress.sh to build and push versioned tags that follow the x.y.z-bci-base-16.0-10.3 pattern. Populate release.env with your registry credentials and tagging preferences before running the script.
When publishing releases, tag images with MAJOR.MINOR.PATCH-bci-base-16.0-10.3 to communicate both the project version and SUSE base image revision.