Skip to content

Commit 3fc51d9

Browse files
authored
fix: volume map to default Docker Deskotp file sharing (/Users) (#211)
Signed-off-by: Ales Verbic <[email protected]>
1 parent dc3ae7d commit 3fc51d9

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

packages/cardano-cli/files/cardano-cli.sh.gotmpl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
declare -a valid_paths=(
4+
"/Users"
5+
"/Volumes"
6+
"/private"
7+
"/tmp"
8+
"/var/folders"
9+
)
10+
311
_args=()
412

513
# Remap absolute paths to /host in the container
@@ -26,13 +34,20 @@ else
2634
_docker_args+=( "-v" "{{ .Paths.ContextDir }}/node-ipc:/ipc" )
2735
fi
2836

37+
if [[ $(uname -s) == Darwin ]]; then
38+
for _path in "${_darwin_allowed_paths[@]}"; do
39+
_docker_args+=( "-v" "${_path}:/host${_path}" )
40+
done
41+
else
42+
_docker_args+=( "-v" "/:/host" )
43+
fi
44+
2945
# Run cardano-cli via Docker
3046
# We map the host filesystem and node socket into the container
3147
docker run \
3248
-ti \
3349
--rm \
3450
-u $(id -u):$(id -g) \
35-
-v /:/host \
3651
-w /host$(pwd) \
3752
-e CARDANO_NODE_SOCKET_PATH=/ipc/node.socket \
3853
"${_docker_args[@]}" \

packages/mithril-client/files/mithril-client.sh.gotmpl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
declare -a _darwin_allowed_paths=(
4+
"/Users"
5+
"/Volumes"
6+
"/private"
7+
"/tmp"
8+
"/var/folders"
9+
)
10+
311
# setup options
412
_options=(${@})
513
for i in ${!_options[@]}; do
@@ -36,6 +44,13 @@ if [[ -z ${GENESIS_VERIFICATION_KEY} && -f ${GENESIS_VERIFICATION_KEY_PATH} ]];
3644
fi
3745

3846
_docker_args=()
47+
if [[ $(uname -s) == Darwin ]]; then
48+
for _path in "${_darwin_allowed_paths[@]}"; do
49+
_docker_args+=( "-v" "${_path}:/host${_path}" )
50+
done
51+
else
52+
_docker_args+=( "-v" "/:/host" )
53+
fi
3954

4055
# flatten options into args
4156
for i in ${_options[@]}; do
@@ -49,11 +64,10 @@ docker run \
4964
-ti \
5065
--rm \
5166
-u $(id -u):$(id -g) \
52-
-v /:/host \
5367
-w /host$(pwd) \
5468
--entrypoint /bin/bash \
55-
-e AGGREGATOR_ENDPOINT=${AGGREGATOR_ENDPOINT} \
56-
-e GENESIS_VERIFICATION_KEY=${GENESIS_VERIFICATION_KEY} \
69+
-e AGGREGATOR_ENDPOINT="${AGGREGATOR_ENDPOINT}" \
70+
-e GENESIS_VERIFICATION_KEY="${GENESIS_VERIFICATION_KEY}" \
5771
"${_docker_args[@]}" \
5872
ghcr.io/blinklabs-io/mithril-client:{{ .Package.Version }} \
5973
-c "GENESIS_VERIFICATION_KEY=\${GENESIS_VERIFICATION_KEY:-\$(</opt/cardano/config/{{ .Context.Network }}/genesis.vkey)} /bin/mithril-client ${_args}"

0 commit comments

Comments
 (0)