mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-25 06:25:44 +03:00
d58772f177
Merge in DNS/adguard-home from 3290-docker-healthcheck to master Updates #3290. Squashed commit of the following: commit 3ac8f26c1c22855d973910fd13c096776aa8dfa6 Merge: bc17565f0df32601
Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Mar 27 01:09:03 2023 +0500 Merge branch 'master' into 3290-docker-healthcheck commit bc17565fcb5acba68129734450fb08b4fe341771 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Sun Mar 26 18:04:08 2023 +0500 all: fix script commit e150fee8025dacdc5aa1d12916d1f42e89216156 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Sun Mar 26 17:18:12 2023 +0500 all: imp naming commit 26b6448d10af39f8363eadd962af228a9d4ae51d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Sun Mar 26 03:13:47 2023 +0500 all: support https web commit b5c09ce8b2ac52d6e47a00f76125bee229f616a0 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Sat Mar 25 20:03:45 2023 +0500 all: imp scripts fmt, naming commit 8c3798c46974e48cc0c379c2ecc46a6d8d54164b Merge: e33b0c5cfb7b8bba
Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Sat Mar 25 00:25:38 2023 +0500 Merge branch 'master' into 3290-docker-healthcheck commit e33b0c5cbfe5a28b29734c9ceee046b0f82a0efe Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 24 16:47:26 2023 +0500 all: fix docs commit 57bfd898b9c468b2b72eba06294ed5e5e0226c20 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 24 16:44:40 2023 +0500 dnsforward: add special-use domain handling commit f04ae13f441a25d0b4dc1359b328552f7507fc23 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 24 16:05:10 2023 +0500 all: imp code commit 32f150f88390320d2da85b54e27f6c751eccb851 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 24 04:19:10 2023 +0500 all: mv Dockerfile, log changes commit a094a44ccfa26988f0e71f19288e08b26e255e2b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Mar 24 04:04:27 2023 +0500 all: finish scripts, imp names commit 4db0d0e7cb7ed69030994bc1b579534dd2c3395d Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Thu Mar 23 18:33:47 2023 +0500 docker: add script and awk program
134 lines
3.7 KiB
Bash
134 lines
3.7 KiB
Bash
#!/bin/sh
|
|
|
|
verbose="${VERBOSE:-0}"
|
|
|
|
if [ "$verbose" -gt '0' ]
|
|
then
|
|
set -x
|
|
debug_flags='-D'
|
|
else
|
|
set +x
|
|
debug_flags=''
|
|
fi
|
|
|
|
set -e -f -u
|
|
|
|
# Require these to be set. The channel value is validated later.
|
|
channel="${CHANNEL:?please set CHANNEL}"
|
|
commit="${COMMIT:?please set COMMIT}"
|
|
dist_dir="${DIST_DIR:?please set DIST_DIR}"
|
|
readonly channel commit dist_dir
|
|
|
|
if [ "${VERSION:-}" = 'v0.0.0' ] || [ "${VERSION:-}" = '' ]
|
|
then
|
|
version="$( sh ./scripts/make/version.sh )"
|
|
else
|
|
version="$VERSION"
|
|
fi
|
|
readonly version
|
|
|
|
# Allow users to use sudo.
|
|
sudo_cmd="${SUDO:-}"
|
|
readonly sudo_cmd
|
|
|
|
docker_platforms="\
|
|
linux/386,\
|
|
linux/amd64,\
|
|
linux/arm/v6,\
|
|
linux/arm/v7,\
|
|
linux/arm64,\
|
|
linux/ppc64le"
|
|
readonly docker_platforms
|
|
|
|
build_date="$( date -u +'%Y-%m-%dT%H:%M:%SZ' )"
|
|
readonly build_date
|
|
|
|
# Set DOCKER_IMAGE_NAME to 'adguard/adguard-home' if you want (and are allowed)
|
|
# to push to DockerHub.
|
|
docker_image_name="${DOCKER_IMAGE_NAME:-adguardhome-dev}"
|
|
readonly docker_image_name
|
|
|
|
# Set DOCKER_OUTPUT to 'type=image,name=adguard/adguard-home,push=true' if you
|
|
# want (and are allowed) to push to DockerHub.
|
|
#
|
|
# If you want to inspect the resulting image using commands like "docker image
|
|
# ls", change type to docker and also set docker_platforms to a single platform.
|
|
#
|
|
# See https://github.com/docker/buildx/issues/166.
|
|
docker_output="${DOCKER_OUTPUT:-type=image,name=${docker_image_name},push=false}"
|
|
readonly docker_output
|
|
|
|
case "$channel"
|
|
in
|
|
('release')
|
|
docker_image_full_name="${docker_image_name}:${version}"
|
|
docker_tags="--tag ${docker_image_name}:latest"
|
|
;;
|
|
('beta')
|
|
docker_image_full_name="${docker_image_name}:${version}"
|
|
docker_tags="--tag ${docker_image_name}:beta"
|
|
;;
|
|
('edge')
|
|
# Don't set the version tag when pushing to the edge channel.
|
|
docker_image_full_name="${docker_image_name}:edge"
|
|
docker_tags=''
|
|
;;
|
|
('development')
|
|
docker_image_full_name="${docker_image_name}"
|
|
docker_tags=''
|
|
;;
|
|
(*)
|
|
echo "invalid channel '$channel', supported values are\
|
|
'development', 'edge', 'beta', and 'release'" 1>&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
readonly docker_image_full_name docker_tags
|
|
|
|
# Copy the binaries into a new directory under new names, so that it's easier to
|
|
# COPY them later. DO NOT remove the trailing underscores. See file
|
|
# docker/Dockerfile.
|
|
dist_docker="${dist_dir}/docker"
|
|
readonly dist_docker
|
|
|
|
mkdir -p "$dist_docker"
|
|
cp "${dist_dir}/AdGuardHome_linux_386/AdGuardHome/AdGuardHome"\
|
|
"${dist_docker}/AdGuardHome_linux_386_"
|
|
cp "${dist_dir}/AdGuardHome_linux_amd64/AdGuardHome/AdGuardHome"\
|
|
"${dist_docker}/AdGuardHome_linux_amd64_"
|
|
cp "${dist_dir}/AdGuardHome_linux_arm64/AdGuardHome/AdGuardHome"\
|
|
"${dist_docker}/AdGuardHome_linux_arm64_"
|
|
cp "${dist_dir}/AdGuardHome_linux_arm_6/AdGuardHome/AdGuardHome"\
|
|
"${dist_docker}/AdGuardHome_linux_arm_v6"
|
|
cp "${dist_dir}/AdGuardHome_linux_arm_7/AdGuardHome/AdGuardHome"\
|
|
"${dist_docker}/AdGuardHome_linux_arm_v7"
|
|
cp "${dist_dir}/AdGuardHome_linux_ppc64le/AdGuardHome/AdGuardHome"\
|
|
"${dist_docker}/AdGuardHome_linux_ppc64le_"
|
|
|
|
# Copy the helper scripts. See file docker/Dockerfile.
|
|
dist_docker_scripts="${dist_docker}/scripts"
|
|
readonly dist_docker_scripts
|
|
|
|
mkdir -p "$dist_docker_scripts"
|
|
cp "./docker/dns-bind.awk"\
|
|
"${dist_docker_scripts}/dns-bind.awk"
|
|
cp "./docker/web-bind.awk"\
|
|
"${dist_docker_scripts}/web-bind.awk"
|
|
cp "./docker/healthcheck.sh"\
|
|
"${dist_docker_scripts}/healthcheck.sh"
|
|
|
|
# Don't use quotes with $docker_tags and $debug_flags because we want word
|
|
# splitting and or an empty space if tags are empty.
|
|
$sudo_cmd docker\
|
|
$debug_flags\
|
|
buildx build\
|
|
--build-arg BUILD_DATE="$build_date"\
|
|
--build-arg DIST_DIR="$dist_dir"\
|
|
--build-arg VCS_REF="$commit"\
|
|
--build-arg VERSION="$version"\
|
|
--output "$docker_output"\
|
|
--platform "$docker_platforms"\
|
|
$docker_tags\
|
|
-t "$docker_image_full_name"\
|
|
-f ./docker/Dockerfile\
|
|
.
|