Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target/
test-output/
output/
.git/
forc_project/out/
issues/
53 changes: 28 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ RUN apt-get update && apt-get install -y \
libssl-dev \
pkg-config \
git \
ca-certificates \
gnupg \
&& rm -rf /var/lib/apt/lists/*

# Install Rust using rustup (the Rust installer)
Expand All @@ -21,24 +23,15 @@ ENV PATH="/root/.cargo/bin:${PATH}"
# Verify the installation
RUN rustc --version

# # Install fuelup
# Install fuelup
RUN curl https://install.fuel.network | sh

ENV PATH="/root/.fuelup/bin:${PATH}"

# Install NVM (Node Version Manager)
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# Set environment variables for NVM and install Node.js v18.19.0
ENV NVM_DIR="/root/.nvm"
ENV NODE_VERSION="v20.14.0"
RUN . "$NVM_DIR/nvm.sh" && \
nvm install $NODE_VERSION && \
nvm use $NODE_VERSION && \
nvm alias default $NODE_VERSION

# Set PATH for Node.js and NPM
ENV PATH="$NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH"
# Install Node.js v20.x directly (no NVM — NVM is designed for interactive shells)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*

# Verify the Node.js installation
RUN node -v
Expand All @@ -52,24 +45,34 @@ RUN fuelup default nightly-2024-05-28-x86_64-unknown-linux-gnu
# Set the working directory
WORKDIR /usr/src/abiprobe

# Copy the current directory contents into the container at /usr/src/abiprobe
COPY . .
# --- Layer ordering: dependencies first, source code last ---

# Copy dependency manifests first for better cache utilization
COPY Cargo.toml Cargo.lock ./

# Create a dummy main.rs to build dependencies (cache Rust deps separately)
RUN mkdir src && echo 'fn main() { println!("dummy"); }' > src/main.rs

# Build dependencies only (this layer is cached until Cargo.toml/Cargo.lock change)
RUN cargo build --release && rm -rf src

# Go to WORKDIR/ts-sdk and run npm install
# Copy ts-sdk package.json and install npm dependencies
COPY ts-sdk/package.json ts-sdk/package-lock.json* ts-sdk/
WORKDIR /usr/src/abiprobe/ts-sdk
# Setup Ts SDK
RUN npm install

# Go to WORKDIR/forc_project and run forc build
# Copy forc_project and build it
WORKDIR /usr/src/abiprobe
COPY forc_project/ forc_project/
WORKDIR /usr/src/abiprobe/forc_project
# Build project
RUN forc build

# Set the working directory
# Now copy the rest of the source code (this is the layer that changes most often)
WORKDIR /usr/src/abiprobe
# Build the Rust application
RUN cargo build
COPY . .

# Build the Rust application in release mode
RUN cargo build --release

# Start a bash shell
ENTRYPOINT ["target/debug/abiprobe"]
# Start the fuzzer
ENTRYPOINT ["target/release/abiprobe"]