-
Notifications
You must be signed in to change notification settings - Fork 14
/
buildWithDocker.sh
executable file
·34 lines (31 loc) · 1.49 KB
/
buildWithDocker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Uncomment for debugging this script
set -o xtrace
# Make sure it works one way or the other to reduce possible errors
if (( EUID == 0 )); then
echo "Run without sudo." 1>&2
exit 1
fi
mkdir -p buildDocker
if [ ! "$(sudo -u root docker ps -a | grep ethercat-master)" ]; then
echo "ethercat-master not found. Running new container."
sudo -u root docker run \
--tty \
--interactive \
--name ethercat-master \
--network host \
--dns=1.1.1.1 \
--volume "$(pwd)/buildDocker":/home/robotlab/dev/ihmc-ethercat-master/build \
--volume "$(pwd)/src":/home/robotlab/dev/ihmc-ethercat-master/src \
--volume "$(pwd)/swig":/home/robotlab/dev/ihmc-ethercat-master/swig \
--volume "$(pwd)/build.gradle.kts":/home/robotlab/dev/ihmc-ethercat-master/build.gradle.kts \
--volume "$(pwd)/gradle.properties":/home/robotlab/dev/ihmc-ethercat-master/gradle.properties \
--volume "$(pwd)/settings.gradle.kts":/home/robotlab/dev/ihmc-ethercat-master/settings.gradle.kts \
--volume "$(pwd)/CMakeLists.txt":/home/robotlab/dev/ihmc-ethercat-master/CMakeLists.txt \
--volume "$(pwd)/build.sh":/home/robotlab/dev/ihmc-ethercat-master/build.sh \
--volume "$(pwd)/gradlew":/home/robotlab/dev/ihmc-ethercat-master/gradlew \
--volume "$(pwd)/gradle/wrapper":/home/robotlab/dev/ihmc-ethercat-master/gradle/wrapper \
ihmcrobotics/ethercat-master:0.2
else
sudo -u root docker start --attach ethercat-master
fi