mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 00:11:16 +00:00
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:
parent
26d8caedb6
commit
c8fa8092c5
@ -163,6 +163,7 @@ cmd_build() {
|
|||||||
[ $build = "release" ] && cargo_args+=("--release")
|
[ $build = "release" ] && cargo_args+=("--release")
|
||||||
|
|
||||||
$DOCKER_RUNTIME run \
|
$DOCKER_RUNTIME run \
|
||||||
|
--user "$(id -u):$(id -g)" \
|
||||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||||
--rm \
|
--rm \
|
||||||
--volume /dev:/dev \
|
--volume /dev:/dev \
|
||||||
@ -186,6 +187,7 @@ cmd_clean() {
|
|||||||
cargo_args=("$@")
|
cargo_args=("$@")
|
||||||
|
|
||||||
$DOCKER_RUNTIME run \
|
$DOCKER_RUNTIME run \
|
||||||
|
--user "$(id -u):$(id -g)" \
|
||||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||||
--rm \
|
--rm \
|
||||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \
|
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \
|
||||||
@ -230,6 +232,7 @@ cmd_tests() {
|
|||||||
if [ "$cargo" = true ] ; then
|
if [ "$cargo" = true ] ; then
|
||||||
say "Running cargo tests..."
|
say "Running cargo tests..."
|
||||||
$DOCKER_RUNTIME run \
|
$DOCKER_RUNTIME run \
|
||||||
|
--user "$(id -u):$(id -g)" \
|
||||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||||
--rm \
|
--rm \
|
||||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \
|
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \
|
||||||
|
Loading…
Reference in New Issue
Block a user