1e5c31af7Sopenharmony_ci#!/bin/bash 2e5c31af7Sopenharmony_ci# Copyright 2022-2024 The Khronos Group Inc. 3e5c31af7Sopenharmony_ci# SPDX-License-Identifier: Apache-2.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci# runDocker - run the Khronos `asciidoctor-spec` Docker image with a local 6e5c31af7Sopenharmony_ci# clone of the Vulkan specification repository. This must be invoked from 7e5c31af7Sopenharmony_ci# the repository root directory. 8e5c31af7Sopenharmony_ci# The following command-line tools are required to run this script: 9e5c31af7Sopenharmony_ci# awk dirname docker grep id realpath 10e5c31af7Sopenharmony_ci# These are all normal Linux developer tools except for 'docker' itself. 11e5c31af7Sopenharmony_ci 12e5c31af7Sopenharmony_ci# Determine path to repository root directory 13e5c31af7Sopenharmony_ciscriptpath=`dirname $0` 14e5c31af7Sopenharmony_cirepopath=`realpath $scriptpath/..` 15e5c31af7Sopenharmony_ci 16e5c31af7Sopenharmony_ci# Get SHA256 of the asciidoctor-spec image build used by CI. 17e5c31af7Sopenharmony_ciimage=`grep -m 1 khronosgroup/docker-images@sha256: $repopath/.gitlab-ci.yml | \ 18e5c31af7Sopenharmony_ci awk '{print $2}'` 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_ciuid=`id -u` 21e5c31af7Sopenharmony_cigid=`id -g` 22e5c31af7Sopenharmony_ciecho "Executing Docker with spec build image and mounted spec repository root:" 23e5c31af7Sopenharmony_ci 24e5c31af7Sopenharmony_ci# --user causes Docker to run as the specified UID:GID instead of as root 25e5c31af7Sopenharmony_ci# -it runs interactively and uses a pseudotty 26e5c31af7Sopenharmony_ci# --rm removes the container on exit 27e5c31af7Sopenharmony_ci# -v mounts the repository clone as /vulkan in the container 28e5c31af7Sopenharmony_ci# $image is image to run 29e5c31af7Sopenharmony_ci# /bin/bash drops into a shell in the container 30e5c31af7Sopenharmony_ciset -x 31e5c31af7Sopenharmony_cidocker run --network=host --user ${uid}:${gid} -it --rm -v ${repopath}:/vulkan $image /bin/bash 32