xref: /aosp_15_r20/external/crosvm/tools/contrib/minimal_containers/run.sh (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1# Copyright 2023 The ChromiumOS Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Example usage:
6#
7#   ./run.sh Dockerfile.ubuntu cargo test --lib --bins --workspace
8
9set -e
10
11cd $(dirname $0)
12
13CROSVM_ROOT=$(realpath "../../../")
14FILENAME=$1
15shift
16DOCKER_BUILDKIT=1 docker build -t crosvm_minimal -f $FILENAME $CROSVM_ROOT
17
18if [[ $# -eq 0 ]]; then
19    docker run --rm -it --volume "${CROSVM_ROOT}:/workspace" crosvm_minimal
20else
21    docker run --rm -it --volume "${CROSVM_ROOT}:/workspace" crosvm_minimal bash -c "${*@Q}"
22fi
23
24