Skip to content

Commit

Permalink
[DOCKER] fix base image for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 committed Feb 10, 2025
1 parent fbca61a commit 36a889e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docker/docker_build_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

get_ipv4_address() {
if command -v ip &>/dev/null; then
ip -o -4 address show | awk '!/127.0.0.1/ {gsub(/\/.*/, "", $4); print $4; exit}'
elif command -v ifconfig &>/dev/null; then
ifconfig | awk '/inet / && $2 != "127.0.0.1" { print $2; exit }'
elif command -v networksetup &>/dev/null; then
networksetup -getinfo Wi-Fi | awk '/IP address:/ { print $3; exit }'
else
echo "Error: No supported command found to fetch IP address." >&2
return 1
fi
}

declare -r USER=astraea
declare -r BUILD=${BUILD:-false}
declare -r RUN=${RUN:-true}
declare -r ADDRESS=$(ip -o -4 address show | awk ' NR==2 { gsub(/\/.*/, "", $4); print $4 } ')
declare -r ADDRESS=$(get_ipv4_address)

# ===================================[functions]===================================

Expand Down

0 comments on commit 36a889e

Please sign in to comment.