mirror of
https://git.vectorsigma.ru/public/AdGuardHome.git
synced 2026-08-03 17:09:34 +00:00
Pull request 2455: imp-docker-build
* commit 'a7db3b919d281c58df4b18212f79a6054876760a': scripts: imp docker build
This commit is contained in:
@@ -27,9 +27,11 @@ fi
|
|||||||
readonly version
|
readonly version
|
||||||
|
|
||||||
# Allow users to use sudo.
|
# Allow users to use sudo.
|
||||||
sudo_cmd="${SUDO:-}"
|
sudo_cmd="${SUDO:-exec}"
|
||||||
readonly sudo_cmd
|
readonly sudo_cmd
|
||||||
|
|
||||||
|
# Make sure that those are built using something like:
|
||||||
|
# make ARCH='386 amd64 arm arm64 ppc64le' OS=linux VERBOSE=1 build-release
|
||||||
docker_platforms="\
|
docker_platforms="\
|
||||||
linux/386,\
|
linux/386,\
|
||||||
linux/amd64,\
|
linux/amd64,\
|
||||||
@@ -104,20 +106,46 @@ cp "${dist_dir}/AdGuardHome_linux_arm_7/AdGuardHome/AdGuardHome" \
|
|||||||
cp "${dist_dir}/AdGuardHome_linux_ppc64le/AdGuardHome/AdGuardHome" \
|
cp "${dist_dir}/AdGuardHome_linux_ppc64le/AdGuardHome/AdGuardHome" \
|
||||||
"${dist_docker}/AdGuardHome_linux_ppc64le_"
|
"${dist_docker}/AdGuardHome_linux_ppc64le_"
|
||||||
|
|
||||||
# Don't use quotes with $docker_version_tag and $docker_channel_tag, because we
|
# docker_opt_tag is a function that wraps the call to docker to optionally add
|
||||||
# want word splitting and or an empty space if tags are empty.
|
# --tag flags.
|
||||||
#
|
docker_opt_tag() {
|
||||||
# TODO(a.garipov): Once flag --tag of docker buildx build supports commas, use
|
# Unset all positional parameters of the function.
|
||||||
# them instead.
|
set --
|
||||||
#
|
|
||||||
# shellcheck disable=SC2086
|
# Set the initial parameters.
|
||||||
$sudo_cmd docker "$debug_flags" \
|
set -- \
|
||||||
buildx build \
|
"$debug_flags" \
|
||||||
--build-arg BUILD_DATE="$build_date" \
|
buildx \
|
||||||
--build-arg DIST_DIR="$dist_dir" \
|
build \
|
||||||
--build-arg VCS_REF="$commit" \
|
--build-arg BUILD_DATE="$build_date" \
|
||||||
--build-arg VERSION="$version" \
|
--build-arg DIST_DIR="$dist_dir" \
|
||||||
--output "$docker_output" \
|
--build-arg VCS_REF="$commit" \
|
||||||
--platform "$docker_platforms" \
|
--build-arg VERSION="$version" \
|
||||||
--progress 'plain' \
|
--output "$docker_output" \
|
||||||
$docker_version_tag $docker_channel_tag -f ./docker/Dockerfile .
|
--platform "$docker_platforms" \
|
||||||
|
--progress 'plain' \
|
||||||
|
;
|
||||||
|
|
||||||
|
# Append the channel tag, if any.
|
||||||
|
if [ "$docker_channel_tag" != '' ]; then
|
||||||
|
set -- "$@" "$docker_channel_tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append the version tag, if any.
|
||||||
|
if [ "$docker_version_tag" != '' ]; then
|
||||||
|
set -- "$@" "$docker_version_tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append the rest.
|
||||||
|
set -- \
|
||||||
|
"$@" \
|
||||||
|
-f \
|
||||||
|
./docker/Dockerfile \
|
||||||
|
. \
|
||||||
|
;
|
||||||
|
|
||||||
|
# Call the docker command with the assembled parameters.
|
||||||
|
"$sudo_cmd" docker "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
docker_opt_tag
|
||||||
|
|||||||
Reference in New Issue
Block a user