From e5037350102095f7d21e9e9909193c1bfa5fd397 Mon Sep 17 00:00:00 2001
From: none <none>
Date: Sun, 20 Nov 2022 21:43:22 +0100
Subject: [PATCH] actually how you want to use a container

---
 Dockerfile     |  5 ++++-
 Makefile       |  5 ++++-
 scripts/all.sh | 14 ++++++++++++--
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index bf5117c..4c7d2d6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,7 +8,7 @@ RUN apt update; apt install -y vim tmux git sudo stow
 RUN adduser user --home /home/user
 RUN echo 'root:root'|chpasswd
 RUN echo 'user:user'|chpasswd
-RUN echo "user ALL=(ALL:ALL) ALL" >> /etc/sudoers
+RUN echo "user ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
 #RUN echo "source /opt/ros/melodic/setup.bash" >> /home/user/.bashrc
 # covenience, this entire block can be removed without affecting the functionality
 USER user
@@ -30,5 +30,8 @@ WORKDIR /home/user/catkin_ws/src
 WORKDIR /home/user/catkin_ws
 USER root
 #RUN chmod u+x /home/user/catkin_ws/scripts/* && chown user: /home/user/catkin_ws/scripts/*
+COPY ./scripts/all.sh /home/user/entrypoint.sh
+RUN chmod +x /home/user/entrypoint.sh
 USER user
 
+CMD ["/bin/bash", "/home/user/entrypoint.sh"]
diff --git a/Makefile b/Makefile
index 134f5de..2e68a81 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,10 @@ build:
 	docker build -t container .
 run:
 	echo running:|figlet
-	docker run -e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix \
+	docker run \
+	--rm \
+	-e DISPLAY=${DISPLAY} \
+	-v /tmp/.X11-unix:/tmp/.X11-unix \
 		-v $(shell readlink -e ./manipulability_metrics):/home/user/catkin_ws/src \
 		-v $(shell readlink -e ./scripts):/home/user/catkin_ws/scripts \
 		-it container 
diff --git a/scripts/all.sh b/scripts/all.sh
index eb24821..0021ce5 100644
--- a/scripts/all.sh
+++ b/scripts/all.sh
@@ -1,2 +1,12 @@
-. ./scripts/prepare.sh
-. ./scripts/start.sh
+## prepare
+# install dependencies
+rosdep update
+rosdep install --from-paths src --ignore-src -r -y
+
+# make and setup
+catkin_make
+source devel/setup.bash
+
+## start
+# run launch file from example
+roslaunch manipulability_metrics_examples panda_manipulability_demo.launch
-- 
GitLab