Page MenuHomeDevCentral

D2343.diff
No OneTemporary

D2343.diff

diff --git a/roles/paas-docker/devel/files/arc.sh b/roles/paas-docker/devel/files/arc.sh
--- a/roles/paas-docker/devel/files/arc.sh
+++ b/roles/paas-docker/devel/files/arc.sh
@@ -52,21 +52,11 @@
fi
fi
-if [ -d ~/.arc/ssh ]; then
- VOLUME_SSH="-v $HOME/.arc/ssh:/home/$USER/.ssh"
-else
- VOLUME_SSH=""
-fi
-
# -------------------------------------------------------------
# Build image
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-test -v $UID && UID=$(id -u)
-test -v $GID && GID=$(id -g)
-IMAGE=nasqueron/arcanist:$UID-$GID
-
-build_image () {
+build_user_image () {
BUILD_DIR=$(mktemp -d -t arc-build-XXXXXXXXXX)
pushd "$BUILD_DIR" > /dev/null || exit 1
>&2 echo "🔨 Building user-specific image $IMAGE for $USER"
@@ -77,12 +67,29 @@
rm -rf "$BUILD_DIR"
}
-test ! -z $(docker images -q "$IMAGE") || build_image
+test -v $UID && UID=$(id -u)
+test -v $GID && GID=$(id -g)
+
+if [ $UID -eq 0 ]; then
+ IMAGE=nasqueron/arcanist
+ CONTAINER_USER_HOME=/root
+else
+ IMAGE=nasqueron/arcanist:$UID-$GID
+ test ! -z $(docker images -q "$IMAGE") || build_user_image
+ CONTAINER_USER_HOME="/home/$USER"
+fi
# -------------------------------------------------------------
# Run container
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ -d ~/.arc/ssh ]; then
+ VOLUME_SSH="-v $HOME/.arc/ssh:$CONTAINER_USER_HOME/.ssh"
+else
+ VOLUME_SSH=""
+fi
+
if [ $PRINT_LOG -eq 0 ]; then
docker run $FLAGS --rm --user $UID:$GID -v ~/.arc:/opt/config -v "$PWD:/opt/workspace" $VOLUME_SSH $IMAGE $COMMAND "$@"
else

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 15:16 (21 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264749
Default Alt Text
D2343.diff (1 KB)

Event Timeline