From 13597db02971f9ce0a68adb77bf4b03a003b6be9 Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <yamanu@xilinx.com> Date: Wed, 4 Dec 2019 11:59:10 +0000 Subject: [PATCH] [Docker] add cmdline arg to run-docker to start notebooks or tests --- Dockerfile | 1 - run-docker.sh | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16abce040..9386126b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,4 +36,3 @@ RUN chown -R $UNAME:$GNAME /home/$UNAME USER $UNAME WORKDIR /home/$UNAME/finn -ENTRYPOINT /bin/bash diff --git a/run-docker.sh b/run-docker.sh index a5241ea0c..e36fa69fc 100755 --- a/run-docker.sh +++ b/run-docker.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash if [ -z "$VIVADO_PATH" ];then echo "For correct implementation please set an environment variable VIVADO_PATH that contains the path to your vivado installation directory" @@ -41,6 +41,17 @@ echo "Mounting $SCRIPTPATH/cnpy into /workspace/cnpy" echo "Mounting $SCRIPTPATH/finn-hlslib into /workspace/finn-hlslib" echo "Mounting $VIVADO_PATH/include into /workspace/vivado-hlslib" +if [ "$1" = "test" ]; then + echo "Running test suite" + DOCKER_CMD="python setup.py test" +elif [ "$1" = "notebook" ]; then + echo "Running Jupyter notebook server" + DOCKER_CMD="jupyter notebook --ip=0.0.0.0 notebooks" +else + echo "Running container only" + DOCKER_CMD="bash" +fi + # Build the FINN Docker image docker build --tag=$DOCKER_TAG \ --build-arg GID=$DOCKER_GID \ @@ -58,4 +69,4 @@ docker run --rm --name finn_dev -it \ -v $SCRIPTPATH/finn-hlslib:/workspace/finn-hlslib \ -v $VIVADO_PATH/include:/workspace/vivado-hlslib \ -p 8888:8888 \ -$DOCKER_TAG bash +$DOCKER_TAG $DOCKER_CMD -- GitLab