diff --git a/docker/Dockerfile.synthetic_network.build b/docker/Dockerfile.synthetic_network.build new file mode 100644 index 0000000000..0486649211 --- /dev/null +++ b/docker/Dockerfile.synthetic_network.build @@ -0,0 +1,39 @@ +FROM node:20.3.0-bookworm + +# Rust nightly +RUN apt-get update && apt-get install -y curl build-essential +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- --default-toolchain nightly-2022-10-30 -y +ENV PATH=${PATH}:/root/.cargo/bin + +# Add and build rush (synthetic network backend / userspace proxy) +ADD rush /opt/src/rush +WORKDIR /opt/src/rush +RUN cargo +nightly-2022-10-30 build --release +RUN mkdir -p /opt/lib/ && cp /opt/src/rush/target/release/rush /opt/lib/rush + +FROM node:20.3.0-bookworm + +# Linux networking tools +RUN apt-get update && apt-get install -y \ + iproute2 ethtool iputils-ping iperf3 python3 lsof tcpdump net-tools + +# TigerVNC and ratposion +# build with `--build-arg VNC=true` +# (you can run for example: +# /opt/lib/run-in-vnc.sh chromium --disable-gpu --no-sandbox +# to have a VNC server with chromium listening on port 5901) +ADD run-in-vnc.sh /opt/lib/ +ARG VNC +RUN if [ -n "$VNC" ] ; then apt-get install -y tigervnc-standalone-server ratpoison ; else echo "No VNC for you" ; fi + +# Copy rush +COPY --from=0 /opt/lib/rush /opt/lib/rush + +# Add frontend (synthetic network web UI) +ADD frontend /opt/lib/frontend + +# Entrypoint / test setup +ADD setup.sh /opt/lib/ +WORKDIR /opt/lib +CMD ["/opt/lib/setup.sh"] \ No newline at end of file diff --git a/scripts/synthetic-network/build_synthetic-network.sh b/scripts/synthetic-network/build_synthetic-network.sh index 7f15995ccd..26146251a7 100755 --- a/scripts/synthetic-network/build_synthetic-network.sh +++ b/scripts/synthetic-network/build_synthetic-network.sh @@ -11,24 +11,10 @@ if [[ "$UPDATE" = true ]]; then git submodule update --remote fi -pushd . -cd scripts/synthetic-network/vendor/synthetic-network - -# this is a dirty-fix for the outdated version of node image used by the -# synthetic-network's Dockerfile -# TODO remove it after this push-request is merged into synthetic-network: https://github.com/daily-co/synthetic-network/pull/14 -docker pull node:20.3.0 -docker tag node:20.3.0 node:12.20.2 - -log "building base docker image for synthetic-network with support for synthetic-network" -docker build --tag syntheticnet --file Dockerfile . - -popd +log "building docker image for synthetic-network" +docker build --tag syntheticnet --file docker/Dockerfile.synthetic_network.build scripts/synthetic-network/vendor/synthetic-network log "building docker image for aleph-node that supports synthetic-network" -docker build -t aleph-node:syntheticnet -f docker/Dockerfile.synthetic_network . - -# clean previously tagged image -docker image rm node:12.20.2 +docker build --tag aleph-node:syntheticnet --file docker/Dockerfile.synthetic_network . exit 0