Skip to content

Commit

Permalink
Use debug builds in our Dockerfiles to reduce CI times
Browse files Browse the repository at this point in the history
Also enables only spawning the mdns service when debug in the coordinator.
  • Loading branch information
kayabaNerve committed Nov 28, 2023
1 parent 571195b commit f3ba8aa
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 25 deletions.
9 changes: 4 additions & 5 deletions coordinator/src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub trait P2p: Send + Sync + Clone + fmt::Debug + TributaryP2p {
#[derive(NetworkBehaviour)]
struct Behavior {
gossipsub: GsBehavior,
//#[cfg(debug_assertions)]
#[cfg(debug_assertions)]
mdns: libp2p::mdns::tokio::Behaviour,
}

Expand Down Expand Up @@ -261,8 +261,7 @@ impl LibP2p {
},

// Only use MDNS in debug environments, as it should have no value in a release build
// TODO: We do tests on release binaries as of right now...
//#[cfg(debug_assertions)]
#[cfg(debug_assertions)]
mdns: {
log::info!("creating mdns service");
libp2p::mdns::tokio::Behaviour::new(libp2p::mdns::Config::default(), throwaway_peer_id)
Expand Down Expand Up @@ -371,7 +370,7 @@ impl LibP2p {
// Handle new incoming messages
event = swarm.next() => {
match event {
//#[cfg(debug_assertions)]
#[cfg(debug_assertions)]
Some(SwarmEvent::Behaviour(BehaviorEvent::Mdns(
libp2p::mdns::Event::Discovered(list),
))) => {
Expand All @@ -383,7 +382,7 @@ impl LibP2p {
}
}
}
//#[cfg(debug_assertions)]
#[cfg(debug_assertions)]
Some(SwarmEvent::Behaviour(BehaviorEvent::Mdns(
libp2p::mdns::Event::Expired(list),
))) => {
Expand Down
4 changes: 2 additions & 2 deletions orchestration/coordinator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
mkdir /serai/bin && \
cargo build -p serai-coordinator --release --all-features && \
mv /serai/target/release/serai-coordinator /serai/bin
cargo build -p serai-coordinator --all-features && \
mv /serai/target/debug/serai-coordinator /serai/bin
FROM debian:bookworm-slim as image

COPY --from=mimalloc libmimalloc.so /usr/lib
Expand Down
4 changes: 2 additions & 2 deletions orchestration/coordinator/Dockerfile.coordinator
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cargo build -p serai-coordinator --release --all-features && \
mv /serai/target/release/serai-coordinator /serai/bin
cargo build -p serai-coordinator --all-features && \
mv /serai/target/debug/serai-coordinator /serai/bin
4 changes: 2 additions & 2 deletions orchestration/message-queue/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
mkdir /serai/bin && \
cargo build --release --all-features -p serai-message-queue && \
mv /serai/target/release/serai-message-queue /serai/bin
cargo build --all-features -p serai-message-queue && \
mv /serai/target/debug/serai-message-queue /serai/bin
FROM debian:bookworm-slim as image

COPY --from=mimalloc libmimalloc.so /usr/lib
Expand Down
4 changes: 2 additions & 2 deletions orchestration/message-queue/Dockerfile.message-queue
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cargo build --release --all-features -p serai-message-queue && \
mv /serai/target/release/serai-message-queue /serai/bin
cargo build --all-features -p serai-message-queue && \
mv /serai/target/debug/serai-message-queue /serai/bin
4 changes: 2 additions & 2 deletions orchestration/processor/bitcoin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
mkdir /serai/bin && \
cargo build --release --features "binaries bitcoin" -p serai-processor && \
mv /serai/target/release/serai-processor /serai/bin
cargo build --features "binaries bitcoin" -p serai-processor && \
mv /serai/target/debug/serai-processor /serai/bin
FROM debian:bookworm-slim as image

COPY --from=mimalloc libmimalloc.so /usr/lib
Expand Down
4 changes: 2 additions & 2 deletions orchestration/processor/bitcoin/Dockerfile.processor.bitcoin
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cargo build --release --features "binaries bitcoin" -p serai-processor && \
mv /serai/target/release/serai-processor /serai/bin
cargo build --features "binaries bitcoin" -p serai-processor && \
mv /serai/target/debug/serai-processor /serai/bin
4 changes: 2 additions & 2 deletions orchestration/processor/monero/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
mkdir /serai/bin && \
cargo build --release --features "binaries monero" -p serai-processor && \
mv /serai/target/release/serai-processor /serai/bin
cargo build --features "binaries monero" -p serai-processor && \
mv /serai/target/debug/serai-processor /serai/bin
FROM debian:bookworm-slim as image

COPY --from=mimalloc libmimalloc.so /usr/lib
Expand Down
4 changes: 2 additions & 2 deletions orchestration/processor/monero/Dockerfile.processor.monero
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cargo build --release --features "binaries monero" -p serai-processor && \
mv /serai/target/release/serai-processor /serai/bin
cargo build --features "binaries monero" -p serai-processor && \
mv /serai/target/debug/serai-processor /serai/bin
4 changes: 2 additions & 2 deletions orchestration/serai/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/serai/target \
mkdir /serai/bin && \
cargo build --release -p serai-node && \
mv /serai/target/release/serai-node /serai/bin
cargo build -p serai-node && \
mv /serai/target/debug/serai-node /serai/bin
FROM debian:bookworm-slim as image

COPY --from=mimalloc libmimalloc.so /usr/lib
Expand Down
4 changes: 2 additions & 2 deletions orchestration/serai/Dockerfile.serai
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cargo build --release -p serai-node && \
mv /serai/target/release/serai-node /serai/bin
cargo build -p serai-node && \
mv /serai/target/debug/serai-node /serai/bin

0 comments on commit f3ba8aa

Please sign in to comment.