-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathbuild_with_docker.sh
More file actions
executable file
·49 lines (41 loc) · 1.14 KB
/
Copy pathbuild_with_docker.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright 2021-2026 Arm Limited and/or its affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
finalversion=""
cleanrepo=""
while [[ $# -gt 0 ]]; do
case "$1" in
--finalversion)
finalversion="--finalversion"
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
shift
done
# Check if repo is in a clean state
if [[ -z "$(git -C "$ROOTDIR" status --porcelain)" ]]; then
cleanrepo="--cleanrepo"
fi
# Get last commit
commithash="--commithash $(git rev-parse HEAD)"
echo "Building pdfs with parameters:"
if [[ -n "$finalversion" ]]; then
echo " --finalversion"
fi
if [[ -n "$cleanrepo" ]]; then
echo " --cleanrepo"
fi
echo " $commithash"
set -x
IMAGE_NAME=acle_build
# Build the image.
docker build -t $IMAGE_NAME --network host tools/docker
# Run the image, mounting the current folder into the /src folder of
# the docker image. Run as the host user so that the output files are owned by them.
docker run --rm -u $(id -u):$(id -g) --mount type=bind,source="$(pwd)",target=/src $IMAGE_NAME $finalversion $commithash $cleanrepo
status=$?
rm -rf ./tmp
exit "$status"