Skip to content

Commit 1c4f1f9

Browse files
committed
fix: build docker in docker
1 parent 7dce9dc commit 1c4f1f9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

aggregation_mode/build.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ use std::collections::HashMap;
33

44
// Reference: https://docs.succinct.xyz/docs/sp1/writing-programs/compiling#advanced-build-options-1
55
fn main() {
6+
// If we are in docker, we don't want to build the programs with docker
7+
let in_docker = std::env::var("IN_DOCKER").is_ok();
8+
69
sp1_build::build_program_with_args("./aggregation_programs/sp1", {
710
sp1_build::BuildArgs {
811
output_directory: Some("./aggregation_programs/sp1/elf".to_string()),
@@ -12,7 +15,7 @@ fn main() {
1215
],
1316
// We use Docker to generate a reproducible ELF that will be identical across all platforms
1417
// (https://docs.succinct.xyz/docs/sp1/writing-programs/compiling#production-builds)
15-
docker: true,
18+
docker: !in_docker,
1619
..Default::default()
1720
}
1821
});
@@ -21,10 +24,14 @@ fn main() {
2124
// regardless of the machine or local environment, will produce the same ImageID
2225
let docker_options = DockerOptionsBuilder::default().build().unwrap();
2326
// Reference: https://github.com/risc0/risc0/blob/main/risc0/build/src/config.rs#L73-L90
24-
let guest_options = GuestOptionsBuilder::default()
25-
.use_docker(docker_options)
26-
.build()
27-
.unwrap();
27+
let guest_options = if !in_docker {
28+
GuestOptionsBuilder::default()
29+
.use_docker(docker_options)
30+
.build()
31+
.unwrap()
32+
} else {
33+
GuestOptionsBuilder::default().build().unwrap()
34+
};
2835

2936
risc0_build::embed_methods_with_options(HashMap::from([(
3037
"risc0_aggregation_program",

docker/proof-aggregator.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN apt update -y && apt install -y gcc
55
COPY crates /aligned_layer/crates/
66
COPY aggregation_mode /aligned_layer/aggregation_mode/
77
WORKDIR /aligned_layer
8-
RUN cargo build --manifest-path ./aggregation_mode/Cargo.toml --features prove --release --bin proof_aggregator_cpu
8+
RUN IN_DOCKER=true cargo build --manifest-path ./aggregation_mode/Cargo.toml --features prove --release --bin proof_aggregator_cpu
99

1010
FROM debian:bookworm-slim AS final
1111

0 commit comments

Comments
 (0)