Files
kata-containers/static-build/cloud-hypervisor/docker-build/build.sh
Gabriela Cervantes ca6df8510c kata-static: Add sudo while building cloud hypervisor docker image
If we want to run the build.sh by using a user this is failing by saying
that `failed to dial gRPC: cannot connect to the Docker daemon...
/var/run/docker.sock: connect: permission denied`. This PR fixes that issue.

Fixes #889

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2019-12-17 16:44:54 -06:00

31 lines
514 B
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
script_dir=$(dirname $(readlink -f "$0"))
docker_image="cloud-hypervisor-builder"
sudo docker build -t "${docker_image}" "${script_dir}"
if test -t 1; then
USE_TTY="-ti"
else
USE_TTY=""
echo "INFO: not tty build"
fi
sudo docker run \
--rm \
-v "$(pwd):/$(pwd)" \
-w "$(pwd)" \
--env "CARGO_HOME=$(pwd)" \
${USE_TTY} \
"${docker_image}" \
cargo build --release