Skip to content

Commit f2066af

Browse files
committed
docker: Lock image build
1 parent 4087a48 commit f2066af

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

docker/linux.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,14 @@ function print_help() {
139139
function build_container() {
140140
log_group_begin "Building image $image_name"
141141

142-
ndk_version=$(cat ndk-version.txt)
143-
dock build -t $image_name --build-arg NDK_VERSION=$ndk_version - < docker/Dockerfile.linux
142+
local ndk_version=$(cat ndk-version.txt)
143+
144+
flock --exclusive docker/Dockerfile.linux \
145+
docker $(docker_host) build \
146+
--tag $image_name \
147+
--file docker/Dockerfile.linux \
148+
--build-arg NDK_VERSION=$ndk_version \
149+
docker
144150

145151
log_group_end
146152
}

docker/utils.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ function check_dependency {
2424
command -v $dep >/dev/null 2>&1 || { error "'$dep' is not installed"; }
2525
}
2626

27-
function dock() {
27+
function docker_host() {
2828
if [ -n "$host" ]; then
29-
docker --host ssh://$host "$@"
30-
else
31-
docker "$@"
29+
echo -n "--host ssh://$host"
3230
fi
3331
}
3432

33+
function dock() {
34+
docker $(docker_host) "$@"
35+
}
36+
3537
function exe() (
3638
local opts=
3739
local history_log=

0 commit comments

Comments
 (0)