File indexing completed on 2024-07-21 05:08:47

0001 #!/usr/bin/env bash
0002 
0003 # exit on first error
0004 set -o errexit
0005 # exit when undefined var is used
0006 set -o nounset
0007 # exit with error code of right-most command in a pipe
0008 set -o pipefail
0009 
0010 # This script opens a bash session in docker for the Dockerfile in this folder.
0011 
0012 readonly image_name=rust_qt_binding_generator_dev
0013 readonly docker_file_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
0014 readonly src_dir=$(dirname "$docker_file_dir")
0015 readonly docker_home_dir="$src_dir/docker_home"
0016 
0017 # create the docker image
0018 docker build -t "$image_name" "$docker_file_dir"
0019 
0020 # create a working directory
0021 if [ ! -a "$docker_home_dir" ]; then
0022     mkdir -p "$docker_home_dir"/rust_qt_binding_generator
0023 fi
0024 
0025 # give the docker application access to X
0026 xhost +si:localuser:"$USER"
0027 
0028 # start a docker session with the source code and a dedicated home directory
0029 docker run --rm -v "$docker_home_dir":/home/neon \
0030   -v "$src_dir":/home/neon/rust_qt_binding_generator \
0031   -v /tmp/.X11-unix:/tmp/.X11-unix \
0032   -e DISPLAY="$DISPLAY" \
0033   -e XDG_CURRENT_DESKTOP="$XDG_CURRENT_DESKTOP" \
0034   -ti "$image_name" bash
0035 
0036 #  --network none \