This README provides instructions for building and running the Phink Docker image. This Dockerfile is designed to create a streamlined environment for building and using Phink.
This Dockerfile setups a build environment using the rust:1.75-slim-bookworm base image. This stage
includes:
-
Installing Dependencies: Essential build tools and libraries are installed to ensure the Rust environment has everything it needs to compile Phink and its dependencies.
curl,git,build-essential, andwgetare installed.- LLVM 19 and Clang 19 are installed
-
Setting Up Rust:
- This Dockerfile sets Rust to nightly version (
nightly) to ensure compatibility with Phink's codebase. - Additional Rust components and tools such as
rust-src,cargo-afl,honggfuzz,grcov, andcargo-contractare installed to support fuzzing and coverage instrumentation.
- This Dockerfile sets Rust to nightly version (
-
Cloning and Building Phink:
- Phink is cloned from the
srlabs/phink - The project is built in release mode.
- Phink is cloned from the
-
Setting the Entry Point:
- The entry point is set to execute the Phink binary directly
-
Default Command:
- The default command provided is for instrumenting a sample contract located in
sample/multi-contract-caller/.
- The default command provided is for instrumenting a sample contract located in
-
Building the Docker Image:
docker build -t phink . -
Running Phink: To run Phink with the default command (running the default example):
docker run --rm phink cargo run
To specify a different contract for instrumentation:
docker run --rm phink cargo run -- instrument <path_to_your_contract>"
To fuzz your instrumented ink! smart-contract:
docker run --rm phink cargo run -- fuzz
- No files copied into
/bin: The Dockerfile intentionally avoids copying files into/binto keep thephink.tomlconfiguration andsample/directory accessible for user interaction within the container.