scripts: dev_cli: Run unprivileged containers as the host user

By default we will run as root inside the container, which means all the
build artifacts will be owned by root. That prevents us from properly
cleaning our build from an unprivileged host user.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2020-02-07 21:17:00 +01:00 committed by Sebastien Boeuf
parent 26d8caedb6
commit c8fa8092c5

View File

@ -163,6 +163,7 @@ cmd_build() {
[ $build = "release" ] && cargo_args+=("--release")
$DOCKER_RUNTIME run \
--user "$(id -u):$(id -g)" \
--workdir "$CTR_CLH_ROOT_DIR" \
--rm \
--volume /dev:/dev \
@ -186,6 +187,7 @@ cmd_clean() {
cargo_args=("$@")
$DOCKER_RUNTIME run \
--user "$(id -u):$(id -g)" \
--workdir "$CTR_CLH_ROOT_DIR" \
--rm \
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \
@ -230,6 +232,7 @@ cmd_tests() {
if [ "$cargo" = true ] ; then
say "Running cargo tests..."
$DOCKER_RUNTIME run \
--user "$(id -u):$(id -g)" \
--workdir "$CTR_CLH_ROOT_DIR" \
--rm \
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \