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