Skip to content

Commit

Permalink
Factor docker/build out of docker/run
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Leoshkevich <[email protected]>
  • Loading branch information
iii-i committed Apr 8, 2024
1 parent 907879b commit 8a8cbfe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
16 changes: 16 additions & 0 deletions docker/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e -u -x -o pipefail
basedir=$(cd "$(dirname "$0")"/.. && pwd)
ARCH=${ARCH-s390x}
deb_arch=$ARCH
gnu_arch=$ARCH
case "$deb_arch on $(uname -m)" in
"ppc64le on ppc64le" | "s390x on s390x" | "x64 on x86_64")
deb_arch=
;;
"ppc64le on "*)
deb_arch=ppc64el
gnu_arch=powerpc64le
;;
esac
docker build --build-arg=deb_arch="$deb_arch" --build-arg=gnu_arch="$gnu_arch" "$@" "$basedir"/docker/image
13 changes: 1 addition & 12 deletions docker/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,7 @@ workdir=$(mktemp -d)
trap 'rm -r "$workdir"' EXIT
iidfile=$workdir/iid
ARCH=${ARCH-s390x}
deb_arch=$ARCH
gnu_arch=$ARCH
case "$deb_arch on $(uname -m)" in
"ppc64le on ppc64le" | "s390x on s390x" | "x64 on x86_64")
deb_arch=
;;
"ppc64le on "*)
deb_arch=ppc64el
gnu_arch=powerpc64le
;;
esac
docker build --build-arg=deb_arch="$deb_arch" --build-arg=gnu_arch="$gnu_arch" --iidfile="$iidfile" "$basedir"/docker/image
"$basedir"/docker/build --iidfile="$iidfile"
iid=$(cat "$iidfile")
read -ra tty_arg < <([ ! -t 0 ] || echo --tty) || true
exec docker run \
Expand Down

0 comments on commit 8a8cbfe

Please sign in to comment.