Home | History | Annotate | Download | only in docker
      1 #!/bin/bash
      2 #
      3 # Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
      4 # for details. All rights reserved. Use of this source code is governed by a
      5 # BSD-style license that can be found in the LICENSE file.
      6 
      7 function follow_links() {
      8   file="$1"
      9   while [ -h "$file" ]; do
     10     # On Mac OS, readlink -f doesn't work.
     11     file="$(readlink "$file")"
     12   done
     13   echo "$file"
     14 }
     15 
     16 PROG_NAME="$(follow_links $0)"
     17 PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
     18 R8_ROOT=$PROG_DIR/../..
     19 
     20 CONTAINER_NAME=r8
     21 HOST_SHARE=$(cd "$R8_ROOT" ; pwd -P)
     22 CONTAINER_USER=r8
     23 CONTAINER_HOME=/home/$CONTAINER_USER
     24 CONTAINER_SHARE=$CONTAINER_HOME/share
     25 
     26 ARGS=$@
     27 
     28 docker run \
     29   --volume $HOST_SHARE:$CONTAINER_SHARE \
     30   --rm \
     31   --workdir "$CONTAINER_SHARE" \
     32   r8 \
     33   bash -c "$ARGS"
     34 
     35