-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·24 lines (21 loc) · 703 Bytes
/
docker-build.sh
File metadata and controls
executable file
·24 lines (21 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# Build AffinityPluginLoader inside a Docker container.
# Usage: ./docker-build.sh [build.sh args...]
# Example: ./docker-build.sh Debug
set -e
ROOTDIR=$(dirname "$(readlink -f "$0")")
IMAGE_NAME="apl-builder"
# Build the Docker image if it doesn't exist (or pass --rebuild to force)
if [ "$1" = "--rebuild" ]; then
shift
docker build -t "$IMAGE_NAME" "$ROOTDIR/docker"
elif ! docker image inspect "$IMAGE_NAME" &>/dev/null; then
echo "Building Docker image '$IMAGE_NAME' (first run)..."
docker build -t "$IMAGE_NAME" "$ROOTDIR/docker"
fi
docker run --rm \
-v "$ROOTDIR:/src" \
-w /src \
--user "$(id -u):$(id -g)" \
"$IMAGE_NAME" \
bash build.sh "$@"