Keeping builds from slowing production on a single-server Docker panel
On a single server running a self-hosted Docker panel, every deploy starts an image build next to the live apps. A Next.js or Rust build can take all CPU cores and a few gigabytes of memory for minutes. Users notice. A few controls keep production responsive.
See it first
Open htop during a deploy, or watch the app's response times. If p95 latency doubles while a build runs, contention is the cause.
Limit build parallelism
Many toolchains use every core by default. Cap them in the Dockerfile:
ENV NODE_OPTIONS=--max-old-space-size=1536
RUN CARGO_BUILD_JOBS=2 cargo build --release
For Go, GOMAXPROCS=2 during go build; for make-based builds, -j2.
Run the builder at lower priority
If you run builds from a script, prefix them with nice -n 10 ionice -c3. The scheduler then serves the live containers first. Some panels let you set build resource limits directly; check yours.
Give the apps guaranteed memory
Set memory limits on build containers, and make sure live apps have enough headroom that a build cannot push them into swap or the OOM killer.
Cache aggressively
Order Dockerfile steps so dependency installs are cached. A build that reuses its dependency layer finishes in a fraction of the time and competes for less.
Move builds elsewhere
The cleanest fix is building on another machine: CI that pushes images to a registry, or a panel that supports a separate build server. Production then only pulls and runs.
Schedule big rebuilds
Base image refreshes that rebuild every app can run at night.
When comparing panels, ask whether they support build servers and build resource limits. The Peon vs Easypanel comparison covers this and other differences. I work on Peon, an open-source self-hosted deployment platform.