Skip to content

Commit

Permalink
Fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
doshitan committed Dec 26, 2024
1 parent d4090be commit 84305c1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions bin/docker-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,43 @@
#
set -euo pipefail

set -x

processed_args=()
docker_flags=()

uname_out="$(uname -s)"
case "${uname_out}" in
Linux*) host_os=Linux;;
Darwin*) host_os=Mac;;
*) host_os="UNKNOWN:${uname_out}"
esac

# not strictly required with magic in `docker-entry` script and mostly for when
# running on Linux, but explicitly run as host user to help avoid any file
# permission issues with mounted locations from the host file system
docker_flags+=(--user "$(id -u):$(id -g)")

# figure out what location to mount for logs
HOST_LOG_DIR=${HOST_LOG_DIR:-}

if [[ -z "${HOST_LOG_DIR}" ]]; then
if [[ "${host_os}" == "Linux" ]]; then
HOST_LOG_DIR="${XDG_STATE_HOME:-${HOME}/.local/state}/nava-platform-cli/log"
elif [[ "${host_os}" == "Mac" ]]; then
HOST_LOG_DIR="${HOME}/Library/Logs/nava-platform-cli"
else
echo "Your host OS '${host_os}' is not supported automatically. Please set HOST_LOG_DIR env var explicitly and try again."
exit 1
fi
fi

if [[ ! -d "${HOST_LOG_DIR}" ]]; then
mkdir -p "${HOST_LOG_DIR}"
fi
docker_flags+=("-v=${HOST_LOG_DIR}:/.local/state/nava-platform-cli/log:z")

# process the script arguments
for ((i=1;i<=$#;i++))
do
eval "arg=\${$i}"
Expand Down

0 comments on commit 84305c1

Please sign in to comment.