Faster local testing with `Dockerfile.debug` (#2869)

* add the debug dockerfile

* script fixes

* speedup debugging

* macOS compatability
This commit is contained in:
Advaita Saha 2024-12-10 11:03:36 +05:30 committed by GitHub
parent 57157a6f76
commit 73a683b641
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 47 additions and 4 deletions

29
Dockerfile.debug Normal file
View File

@ -0,0 +1,29 @@
# Nimbus
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
FROM debian:stable-slim AS build
ENV DEBIAN_FRONTEND=noninteractive TZ="Etc/UTC"
ENV NPROC=8
RUN apt update \
&& apt install make bash build-essential curl git -y
COPY ./ /nimbus-eth1
WORKDIR /nimbus-eth1
RUN make -j${NPROC} nimbus_execution_client && \
mv build/nimbus_execution_client /usr/local/bin/nimbus_execution_client
# --------------------------------- #
# Starting new image to reduce size #
# --------------------------------- #
FROM debian:stable-slim AS deploy
COPY --from=build /usr/local/bin/nimbus_execution_client /usr/local/bin/nimbus_execution_client
ENTRYPOINT ["/usr/local/bin/nimbus_execution_client"]

View File

@ -16,10 +16,25 @@
echo echo
printf "Do you want to run the checks in terminal or visit the assertoor URL? (terminal/url) " printf "Do you want to run the checks in terminal or visit the assertoor URL? (terminal/url) "
read reply read reply
if [[ "$reply" != "terminal" && "$reply" != "url" ]]; then
echo "Invalid input: '$reply'. Please enter 'terminal' or 'url'."
exit 1
fi
echo echo
printf "Build new changes (yes/no)? " printf "Build new changes (yes/no)? "
read use_previous_image read use_previous_image
if [[ "$use_previous_image" != "yes" && "$use_previous_image" != "no" ]]; then
echo "Invalid input: '$use_previous_image'. Please enter 'yes' or 'no'."
exit 1
fi
# Set dockerfile_name based on --debug argument
if [[ "$1" == "--debug" ]]; then
dockerfile_name="Dockerfile.debug"
else
dockerfile_name="Dockerfile"
fi
# ------------------------------------------------ # ------------------------------------------------
# Installation Checks # Installation Checks
@ -71,7 +86,7 @@ if [[ "$use_previous_image" == "no" ]]; then
else else
echo "Starting the Docker Build!" echo "Starting the Docker Build!"
# Build the docker Image # Build the docker Image
sudo docker build . -t localtestnet sudo docker build -t localtestnet -f $dockerfile_name .
# The new el_image value # The new el_image value
new_el_image="localtestnet" new_el_image="localtestnet"
fi fi
@ -82,8 +97,7 @@ fi
# ------------------------------------------------ # ------------------------------------------------
# Use sed to replace the el_image value in the file # Use sed to replace the el_image value in the file
cat kurtosis-network-params.yml | envsubst > assertoor.yaml sed "s/el_image: .*/el_image: $new_el_image/" kurtosis-network-params.yml > assertoor.yaml
sed -i "s/el_image: .*/el_image: $new_el_image/" assertoor.yaml
sudo kurtosis run \ sudo kurtosis run \
--enclave nimbus-localtestnet \ --enclave nimbus-localtestnet \
@ -91,7 +105,7 @@ sudo kurtosis run \
--args-file assertoor.yaml --args-file assertoor.yaml
enclave_dump=$(kurtosis enclave inspect nimbus-localtestnet) enclave_dump=$(kurtosis enclave inspect nimbus-localtestnet)
assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep -Eo "http://[0-9.:]+")
# ------------------------------------------------ # ------------------------------------------------
# Remove Generated File # Remove Generated File