From d54b5fc42a5c6f4c2aafdc1f456b69d0197235cf Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Mon, 10 Feb 2020 15:50:53 +0100
Subject: [PATCH] [Docker] add argument and port-forward for Netron as well

---
 Dockerfile    | 2 ++
 run-docker.sh | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/Dockerfile b/Dockerfile
index 2769ab91f..734a8fd3f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -32,6 +32,7 @@ ARG UNAME
 ARG UID
 ARG PASSWD
 ARG JUPYTER_PORT
+ARG NETRON_PORT
 
 RUN groupadd -g $GID $GNAME
 RUN useradd -M -u $UID $UNAME -g $GNAME
@@ -45,4 +46,5 @@ USER $UNAME
 RUN echo "source \$VIVADO_PATH/settings64.sh" >> /home/$UNAME/.bashrc
 RUN echo "PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '" >>  /home/$UNAME/.bashrc
 EXPOSE $JUPYTER_PORT
+EXPOSE $NETRON_PORT
 WORKDIR /home/$UNAME/finn
diff --git a/run-docker.sh b/run-docker.sh
index 0cbdff79b..d774f0871 100755
--- a/run-docker.sh
+++ b/run-docker.sh
@@ -16,6 +16,7 @@ DOCKER_RND=$(shuf -i0-32768 -n1)
 DOCKER_TAG="finn_${DOCKER_UNAME}"
 DOCKER_INST_NAME="finn_${DOCKER_UNAME}_${DOCKER_RND}"
 : ${JUPYTER_PORT=8888}
+: ${NETRON_PORT=8081}
 
 # Absolute path to this script, e.g. /home/user/bin/foo.sh
 SCRIPT=$(readlink -f "$0")
@@ -60,6 +61,7 @@ echo "Mounting $SCRIPTPATH/PYNQ-HelloWorld into /workspace/PYNQ-HelloWorld"
 echo "Mounting $BUILD_LOCAL into $BUILD_LOCAL"
 echo "Mounting $VIVADO_PATH into $VIVADO_PATH"
 echo "Port-forwarding for Jupyter $JUPYTER_PORT:$JUPYTER_PORT"
+echo "Port-forwarding for Netron $NETRON_PORT:$NETRON_PORT"
 
 if [ "$1" = "test" ]; then
         echo "Running test suite"
@@ -80,6 +82,7 @@ docker build --tag=$DOCKER_TAG \
              --build-arg UID=$DOCKER_UID \
              --build-arg PASSWD=$DOCKER_PASSWD \
              --build-arg JUPYTER_PORT=$JUPYTER_PORT \
+             --build-arg NETRON_PORT=$NETRON_PORT \
              .
 # Launch container with current directory mounted
 docker run -t --rm --name $DOCKER_INST_NAME -it \
@@ -99,4 +102,5 @@ docker run -t --rm --name $DOCKER_INST_NAME -it \
 -e FINN_INST_NAME=$DOCKER_INST_NAME \
 -e FINN_ROOT="/workspace/finn" \
 -p $JUPYTER_PORT:$JUPYTER_PORT \
+-p $NETRON_PORT:$NETRON_PORT \
 $DOCKER_TAG bash -c "$DOCKER_CMD"
-- 
GitLab