feat: install foundry binaries into run.Dockerfile

This commit is contained in:
adrian
2025-09-11 08:50:09 +02:00
committed by Adrian Benavides
parent 0de847740a
commit 805447f82b
3 changed files with 19 additions and 7 deletions

View File

@@ -32,6 +32,14 @@ RUN apt-get update && apt-get install -y curl
RUN curl -L https://github.com/streamingfast/substreams/releases/download/v1.16.4/substreams_linux_arm64.tar.gz \
| tar -zxf -
# Stage 3: Install Foundry (Forge)
FROM debian:bookworm AS foundry-builder
WORKDIR /build
RUN apt-get update && apt-get install -y curl git
RUN curl -L https://foundry.paradigm.xyz | bash
RUN /root/.foundry/bin/foundryup
# Stage 4: Final image
FROM debian:bookworm
@@ -44,7 +52,10 @@ COPY --from=tycho-indexer-builder /build/tycho-indexer/target/release/tycho-inde
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/protocol-testing/target/release/protocol-testing /usr/local/bin/tycho-protocol-sdk
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/substreams /app/substreams
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/proto /app/proto
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/evm /app/evm
COPY --from=substreams-cli-builder /build/substreams /usr/local/bin/substreams
COPY --from=foundry-builder /root/.foundry/bin/forge /usr/local/bin/forge
COPY --from=foundry-builder /root/.foundry/bin/cast /usr/local/bin/cast
# Entrypoint script to run tests
COPY entrypoint.sh /entrypoint.sh

View File

@@ -4,6 +4,7 @@ use std::{
};
use miette::{miette, IntoDiagnostic, WrapErr};
use tracing::{debug, info};
pub struct AdapterContractBuilder {
src_path: String,
@@ -65,14 +66,14 @@ impl AdapterContractBuilder {
.into_diagnostic()
.wrap_err(miette!("Error running '{script_path}'"))?;
println!("Output:\n{}", String::from_utf8_lossy(&output.stdout));
if !output.stderr.is_empty() {
println!("Errors:\n{}", String::from_utf8_lossy(&output.stderr));
}
if !output.status.success() {
return Err(miette!("An error occurred: {}", String::from_utf8_lossy(&output.stderr)));
return Err(miette!(
"Failed to build adapter: {}",
String::from_utf8_lossy(&output.stderr)
));
}
info!("Adapter built successfully");
debug!("{}", String::from_utf8_lossy(&output.stdout));
self.find_contract(adapter_contract)
}

View File

@@ -58,7 +58,7 @@ impl TestRunner {
vm_traces: bool,
) -> Self {
let repo_root = env::current_dir().expect("Failed to get current directory");
let evm_path = repo_root.join("../evm");
let evm_path = repo_root.join("evm");
let adapter_contract_builder =
AdapterContractBuilder::new(evm_path.to_string_lossy().to_string());
Self {