Skip to content

Commit 3185c99

Browse files
committed
docker: select reduced circuits via env
1 parent 2112ef6 commit 3185c99

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

docker/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ COPY .cargo .cargo
3232
COPY bin bin
3333
COPY crates crates
3434

35-
# Build the release binary
36-
RUN cargo build --release --features=reduced-circuits --bin mosaic \
37-
&& strip --strip-debug target/release/mosaic
35+
# Build both release binaries so runtime can switch via env var.
36+
RUN cargo build --release --bin mosaic \
37+
&& cp target/release/mosaic target/release/mosaic-default \
38+
&& cargo build --release --features=reduced-circuits --bin mosaic \
39+
&& mv target/release/mosaic target/release/mosaic-reduced \
40+
&& strip --strip-debug target/release/mosaic-default target/release/mosaic-reduced
3841

3942
# ------------------------------------------------------------------------------
4043
# Stage 2: Minimal runtime image
@@ -62,7 +65,8 @@ RUN FDB_ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "amd64") \
6265
# FDB cluster file – path configured via storage.cluster_file in config.toml
6366
RUN mkdir -p /etc/mosaic && chown ubuntu:ubuntu /etc/mosaic
6467

65-
COPY --from=builder /build/target/release/mosaic /usr/local/bin/mosaic
68+
COPY --from=builder /build/target/release/mosaic-default /usr/local/bin/mosaic
69+
COPY --from=builder /build/target/release/mosaic-reduced /usr/local/bin/mosaic-reduced
6670
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
6771
RUN chmod +x /usr/local/bin/entrypoint.sh
6872

docker/entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# The config file's [circuit] section should reference:
99
# path = "/etc/mosaic/circuit.v5c"
1010
#
11+
# Set MOSAIC_REDUCED_CIRCUITS=1 to run the reduced-circuits build.
12+
#
1113
# Any extra arguments are forwarded to the mosaic binary.
1214

1315
set -euo pipefail
@@ -20,4 +22,12 @@ if [ ! -f "$CONFIG_PATH" ]; then
2022
exit 1
2123
fi
2224

23-
exec /usr/local/bin/mosaic "$CONFIG_PATH" "$@"
25+
MOSAIC_BIN="/usr/local/bin/mosaic"
26+
27+
case "${MOSAIC_REDUCED_CIRCUITS:-}" in
28+
1|true|TRUE|yes|YES|on|ON)
29+
MOSAIC_BIN="/usr/local/bin/mosaic-reduced"
30+
;;
31+
esac
32+
33+
exec "$MOSAIC_BIN" "$CONFIG_PATH" "$@"

0 commit comments

Comments
 (0)