osa-docker.sh 1.01 KB
Newer Older
1 2
#!/bin/bash

Volodymyr SAVCHENKO's avatar
Volodymyr SAVCHENKO committed
3
#set -xe
4 5 6 7

COMMAND=$@

echo "REP_BASE_PROD: ${REP_BASE_PROD:?please set this variable to the current data location}"
8
echo "CURRENT_IC: ${CURRENT_IC:?please set this variable to the current IC location (could be REP_BASE_PROD, but we would not like to assume...)}"
9 10
echo "using WORKDIR: ${WORKDIR:=$PWD}"

11 12 13 14 15 16
for directory in "$REP_BASE_PROD/scw" "$REP_BASE_PROD/aux" "$CURRENT_IC/ic" "$CURRENT_IC/idx" "$WORKDIR"; do
    [ -d $directory ] || { echo "directory \"$directory\" should exist"; exit 1; }
done

[ -s /tmp/.X11-unix ] || { echo "no /tmp/.X11-unix? no X? not allowed!"; }

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
mkdir -pv $WORKDIR/pfiles

docker run \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v $WORKDIR:/home/integral \
    -v $REP_BASE_PROD/scw:/data/scw:ro \
    -v $REP_BASE_PROD/aux:/data/aux:ro \
    -v $CURRENT_IC/ic:/data/ic:ro \
    -v $CURRENT_IC/idx:/data/idx:ro \
    --rm -it  --user $(id -u) \
        integralsw/osa:11.0 bash -c "

. init.sh

cd \$HOME

echo -e '\\e[31mrunning\\e[37m $COMMAND\\e[0m'

$COMMAND
"