blob: 235e20e361fa4bde2fe3810b27cdee5d2ea59d67 [file] [log] [blame]
#!/bin/bash
# Copyright 2022-2023 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# runDocker - run the Khronos `asciidoctor-spec` Docker image with a local
# clone of the Vulkan specification repository. This must be invoked from
# the repository root directory.
# The following command-line tools are required to run this script:
# awk dirname docker grep id realpath
# These are all normal Linux developer tools except for 'docker' itself.
# Determine path to repository root directory
scriptpath=`dirname $0`
repopath=`realpath $scriptpath/..`
# Get SHA256 of the asciidoctor-spec image build used by CI.
image=`grep -m 1 khronosgroup/docker-images@sha256: $repopath/.gitlab-ci.yml | \
awk '{print $2}'`
uid=`id -u`
gid=`id -g`
echo "Executing Docker with spec build image and mounted spec repository root:"
# --user causes Docker to run as the specified UID:GID instead of as root
# -it runs interactively and uses a pseudotty
# --rm removes the container on exit
# -v mounts the repository clone as /vulkan in the container
# $image is image to run
# /bin/bash drops into a shell in the container
set -x
docker run --network=host --user ${uid}:${gid} -it --rm -v ${repopath}:/vulkan $image /bin/bash