fix(docker): lower default build memory (#2420)

This commit is contained in:
Aqil Aziz
2026-05-23 01:55:52 -07:00
committed by GitHub
parent b47b71ea3f
commit f4ea6a494b
2 changed files with 15 additions and 4 deletions
+11 -4
View File
@@ -11,7 +11,13 @@
# ==========================================================================
FROM rust:1.93-bookworm AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Docker builds often run on small VPS/CI builders. The crate's `ci` profile
# keeps peak rustc memory lower than `release`; override with
# `--build-arg CARGO_PROFILE=release` when maximum runtime optimization matters.
ARG CARGO_PROFILE=ci
ARG CARGO_BUILD_JOBS=1
ENV DEBIAN_FRONTEND=noninteractive \
CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS}
# System dependencies required for compilation.
#
@@ -43,14 +49,15 @@ COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
RUN mkdir -p src && \
echo 'fn main() {}' > src/main.rs && \
echo 'pub fn run_core_from_args(_: &[String]) -> anyhow::Result<()> { Ok(()) }' > src/lib.rs && \
cargo build --release --bin openhuman-core 2>/dev/null || true && \
cargo build --profile "${CARGO_PROFILE}" --bin openhuman-core 2>/dev/null || true && \
rm -rf src
# Copy actual source and build
COPY src/ src/
# Touch main.rs to force rebuild of our code (not deps)
RUN touch src/main.rs src/lib.rs && \
cargo build --release --bin openhuman-core
cargo build --profile "${CARGO_PROFILE}" --bin openhuman-core && \
cp "target/${CARGO_PROFILE}/openhuman-core" /tmp/openhuman-core
# ==========================================================================
# Stage 2: Minimal runtime image
@@ -84,7 +91,7 @@ RUN mkdir -p /home/openhuman/.openhuman \
&& chown -R openhuman:openhuman /home/openhuman
# Copy the built binary
COPY --from=builder /build/target/release/openhuman-core /usr/local/bin/openhuman-core
COPY --from=builder /tmp/openhuman-core /usr/local/bin/openhuman-core
# Copy the entrypoint script that chowns the workspace volume before dropping
# privileges. The script is a separate file so the E2E entrypoint
+4
View File
@@ -649,6 +649,10 @@ To run the same check locally:
```bash
docker build -t openhuman-core:smoke .
# Optional: tune build profile and Cargo parallelism.
# Keep CARGO_BUILD_JOBS=1 on constrained builders; raise it on larger machines.
docker build --build-arg CARGO_PROFILE=release --build-arg CARGO_BUILD_JOBS=4 -t openhuman-core:release .
# Token-set path (App Platform):
docker run -d --name oh-smoke -p 7788:7788 \
-e OPENHUMAN_CORE_TOKEN=smoke-test-token \