Skip to content

Commit

Permalink
L1-278: Fix synthetic-network repo compilation (#1807)
Browse files Browse the repository at this point in the history
# Description

Added a custom version of the Dockerfile from the repo of the
synthetic-network tool that uses a more specific version of the rust
compiler. Also removed an ad-hoc fix for node-js images used by the
original Dockerfile.

## Type of change

- Bug fix (non-breaking change which fixes an issue)
  • Loading branch information
fixxxedpoint authored Sep 6, 2024
1 parent 8cfb81e commit 479bdf0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 17 deletions.
39 changes: 39 additions & 0 deletions docker/Dockerfile.synthetic_network.build
Original file line number Diff line number Diff line change
@@ -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"]
20 changes: 3 additions & 17 deletions scripts/synthetic-network/build_synthetic-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 479bdf0

Please sign in to comment.