Skip to content
Snippets Groups Projects
Commit 8f7133ba authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Docker] use JUPYTER_PORT to specify the Jupyter notebook port

parent 21db89a7
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ ARG GNAME
ARG UNAME
ARG UID
ARG PASSWD
ARG JUPYTER_PORT
RUN groupadd -g $GID $GNAME
RUN useradd -M -u $UID $UNAME -g $GNAME
......@@ -43,5 +44,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
WORKDIR /home/$UNAME/finn
......@@ -11,7 +11,7 @@ DOCKER_UNAME=$(id -un)
DOCKER_UID=$(id -u)
DOCKER_PASSWD="finn"
DOCKER_TAG="finn_$DOCKER_UNAME"
: ${DOCKER_PORT_FORWARD="-p 8888:8888 -p 8081:8081"}
: ${JUPYTER_PORT=8888}
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
......@@ -54,14 +54,14 @@ echo "Mounting $SCRIPTPATH/pyverilator into /workspace/pyverilator"
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 with $DOCKER_PORT_FORWARD"
echo "Port-forwarding for Jupyter $JUPYTER_PORT:$JUPYTER_PORT"
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="source ~/.bashrc; jupyter notebook --ip=0.0.0.0 notebooks"
DOCKER_CMD="source ~/.bashrc; jupyter notebook --ip=0.0.0.0 --port $JUPYTER_PORT notebooks"
else
echo "Running container only"
DOCKER_CMD="bash"
......@@ -74,6 +74,7 @@ docker build --tag=$DOCKER_TAG \
--build-arg UNAME=$DOCKER_UNAME \
--build-arg UID=$DOCKER_UID \
--build-arg PASSWD=$DOCKER_PASSWD \
--build-arg JUPYTER_PORT=$JUPYTER_PORT \
.
# Launch container with current directory mounted
docker run -t --rm --name finn_dev_$DOCKER_UNAME -it \
......@@ -89,5 +90,5 @@ docker run -t --rm --name finn_dev_$DOCKER_UNAME -it \
-v $BUILD_LOCAL:$BUILD_LOCAL \
-v $VIVADO_PATH:$VIVADO_PATH \
-e VIVADO_PATH=$VIVADO_PATH \
$DOCKER_PORT_FORWARD \
-p $JUPYTER_PORT:$JUPYTER_PORT \
$DOCKER_TAG bash -c "$DOCKER_CMD"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment