From 9796f0cae4ac91457399240b0c351d103dc52e60 Mon Sep 17 00:00:00 2001
From: TIm Kluge <timklge@gmail.com>
Date: Fri, 1 May 2020 15:09:57 +0200
Subject: [PATCH] ref #1: Use container build args for UID and GID, move build
 to run script, update README

---
 Dockerfile    | 4 ++--
 README.md     | 8 ++------
 docker-run.sh | 4 ++++
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index f7d9214..cd14acf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
 FROM osrf/ros:melodic-desktop-full-bionic
 
-ENV uid 1000
-ENV gid 1000
+ARG uid=1000
+ARG gid=1000
 
 COPY entrypoint.sh /entrypoint.sh
 RUN chmod +x /entrypoint.sh
diff --git a/README.md b/README.md
index 289ee8b..17a7ae6 100644
--- a/README.md
+++ b/README.md
@@ -48,11 +48,7 @@ See the [README.md of the submodule](../../../../sample_applications/-/blob/mast
 
 To run via docker on any up-to-date linux system:
 
-- **Either** clone this repo and its submodules (recommended for fresh installations):
+- Clone this repo and its submodules (recommended for fresh installations):
     - as a guest: `git clone --recurse-submodules https://git-st.inf.tu-dresden.de/ceti/ros/panda_gazebo_workspace.git panda_gazebo_workspace`
     - as a project member with a registered ssh key: `git clone --recurse-submodules git@git-st.inf.tu-dresden.de:ceti/ros/panda_gazebo_workspace.git panda_gazebo_workspace`
-- `docker build . -t ceti-panda-gazebo-workspace`
-- `./docker-run.sh roslaunch sample_applications sample_simple_simulation.launch`
-
-Note that this expects your `uid` and `gid` to be `1000`. This is generally the case if your user is the primary user on your system. Otherwise, please change
-the values at the top of the `Dockerfile`.
\ No newline at end of file
+- Run `./docker-run.sh roslaunch sample_applications sample_simple_simulation.launch` to build and run a docker image tagged with `ceti-panda-gazebo-workspace`
\ No newline at end of file
diff --git a/docker-run.sh b/docker-run.sh
index 8fbb638..dfc54c7 100755
--- a/docker-run.sh
+++ b/docker-run.sh
@@ -2,6 +2,10 @@
 
 # http://wiki.ros.org/docker/Tutorials/GUI
 
+docker build . -t ceti-panda-gazebo-workspace \
+    --build-arg UID=$UID \
+    --build-arg GID=$GID
+
 XSOCK=/tmp/.X11-unix
 XAUTH=/tmp/.docker.xauth
 touch $XAUTH
-- 
GitLab