-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Dockerfile to set host time zone, UID, GID
DCO 1.1 Signed-off-by: Tatsuya Ishihara <[email protected]>
- Loading branch information
1 parent
12befdb
commit 73685e1
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Default values | ||
HOST_UID=${HOST_UID:-1000} | ||
HOST_GID=${HOST_GID:-1000} | ||
HOST_TZ=${HOST_TZ:-UTC} | ||
|
||
if [[ $TZ != $HOST_TZ ]]; then | ||
# Setting up timezone | ||
sudo ln -snf /usr/share/zoneinfo/$HOST_TZ /etc/localtime | ||
echo $HOST_TZ | sudo tee /etc/timezone | ||
export TZ=$HOST_TZ | ||
fi | ||
|
||
CONT_UID=$(id -u developer) | ||
CONT_GID=$(id -g developer) | ||
if [[ $CONT_UID -ne $HOST_UID ]] || [[ $CONT_GID -ne $HOST_GID ]]; then | ||
# Update user and group ID to match host | ||
sudo usermod -u $HOST_UID developer | ||
sudo groupmod -g $HOST_GID developer | ||
chown -R "$HOST_UID:$HOST_GID" /home/developer | ||
fi | ||
|
||
# Source ROS setup script | ||
source "/opt/custom_ws/install/setup.bash" | ||
|
||
WORKDIR=$(pwd) | ||
|
||
exec gosu developer bash -c "cd $WORKDIR && exec $*" |