mirror of https://github.com/linkerd/linkerd2.git
Consider arch when building policy-controller (#7343)
When building the policy controller the `amd64.dockerfile` is hardcoded regardless of the arch being used to build the image. This changes the Dockerfile to consider the arch (`uname -m`) when building the policy controller and use the correct file. Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
This commit is contained in:
parent
e05aaa3195
commit
778bbdfb8f
29
bin/_os.sh
29
bin/_os.sh
|
@ -4,18 +4,7 @@ set -eu
|
|||
|
||||
export OS_ARCH_ALL="linux-amd64 linux-arm64 linux-arm darwin darwin-arm64 windows"
|
||||
|
||||
os() {
|
||||
os=$(uname -s)
|
||||
arch=""
|
||||
case $os in
|
||||
CYGWIN* | MINGW64*)
|
||||
os=windows
|
||||
;;
|
||||
Darwin)
|
||||
os=darwin
|
||||
;;
|
||||
Linux)
|
||||
os=linux
|
||||
architecture() {
|
||||
arch=$(uname -m)
|
||||
case $arch in
|
||||
x86_64)
|
||||
|
@ -38,6 +27,22 @@ os() {
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "$arch"
|
||||
}
|
||||
|
||||
os() {
|
||||
os=$(uname -s)
|
||||
arch=""
|
||||
case $os in
|
||||
CYGWIN* | MINGW64*)
|
||||
os=windows
|
||||
;;
|
||||
Darwin)
|
||||
os=darwin
|
||||
;;
|
||||
Linux)
|
||||
os=linux
|
||||
arch=$(architecture)
|
||||
;;
|
||||
*)
|
||||
echo "unsupported os: $os" >&2
|
||||
|
|
|
@ -13,6 +13,8 @@ bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
|
|||
. "$bindir"/_docker.sh
|
||||
# shellcheck source=_tag.sh
|
||||
. "$bindir"/_tag.sh
|
||||
# shellcheck source=_os.sh
|
||||
. "$bindir"/_os.sh
|
||||
|
||||
if [ "$DOCKER_TARGET" = 'multi-arch' ]; then
|
||||
echo "DOCKER_TARGET may not be set to 'multi-arch' with $0" >&2
|
||||
|
@ -20,4 +22,5 @@ if [ "$DOCKER_TARGET" = 'multi-arch' ]; then
|
|||
fi
|
||||
|
||||
dir=$( cd "$bindir"/../policy-controller && pwd )
|
||||
docker_build policy-controller "${TAG:-$(head_root_tag)}" "$dir/amd64.dockerfile"
|
||||
arch=$(architecture)
|
||||
docker_build policy-controller "${TAG:-$(head_root_tag)}" "$dir/$arch.dockerfile"
|
||||
|
|
Loading…
Reference in New Issue