Skip to content

Commit eba5688

Browse files
committed
taprpc+scripts: detect Podman wrapper and preserve Docker UID mapping
Detect Podman by checking "$DOCKER --version", allowing overrides via the DOCKER environment variable. Retain "--user $UID:$(id -g)" for Docker/CI to ensure generated files are user-owned. For Podman, switch to "--user=0:0" to avoid EACCES errors caused by rootless subuid/subgid remapping on bind mounts. - scripts/gen_sqlc_docker.sh: add runtime user selection; use $DOCKER for run - taprpc/gen_protos_docker.sh: same detection logic; use $DOCKER for build/run Fixes "Permission denied" errors with rootless Podman, while maintaining existing Docker behavior.
1 parent b3f821e commit eba5688

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

scripts/gen_sqlc_docker.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
set -e
44

5+
# Use docker by default; allow overrides and detect podman wrapper.
6+
DOCKER=${DOCKER:-docker}
7+
user_args=(--user "$UID:$(id -g)")
8+
if $DOCKER --version 2>/dev/null | grep -qi podman; then
9+
user_args=(--user=0:0)
10+
fi
11+
512
# restore_files is a function to restore original schema files.
613
restore_files() {
714
echo "Restoring SQLite bigint patch..."
@@ -40,9 +47,9 @@ echo "Generating sql models and queries in go..."
4047

4148
# Run the script to generate the new generated code. Once the script exits, we
4249
# use `trap` to make sure all files are restored.
43-
docker run \
50+
$DOCKER run \
4451
--rm \
45-
--user "$UID:$(id -g)" \
52+
"${user_args[@]}" \
4653
-e UID=$UID \
4754
-v "$DIR/../:/build" \
4855
-w /build \

taprpc/gen_protos_docker.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
set -e
44

5+
# Use docker by default; allow overrides and detect podman wrapper.
6+
DOCKER=${DOCKER:-docker}
7+
user_args=(--user "$UID:$(id -g)")
8+
if $DOCKER --version 2>/dev/null | grep -qi podman; then
9+
user_args=(--user=0:0)
10+
fi
11+
512
# Directory of the script file, independent of where it's called from.
613
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
714

@@ -10,16 +17,16 @@ GRPC_GATEWAY_VERSION=$(go list -f '{{.Version}}' -m github.com/grpc-ecosystem/gr
1017
LND_VERSION=$(go list -f '{{.Version}}' -m github.com/lightningnetwork/lnd)
1118

1219
echo "Building protobuf compiler docker image..."
13-
docker build -t taproot-assets-protobuf-builder \
20+
$DOCKER build -t taproot-assets-protobuf-builder \
1421
--build-arg PROTOBUF_VERSION="$PROTOBUF_VERSION" \
1522
--build-arg GRPC_GATEWAY_VERSION="$GRPC_GATEWAY_VERSION" \
1623
--build-arg LND_VERSION="$LND_VERSION" \
1724
.
1825

1926
echo "Compiling and formatting *.proto files..."
20-
docker run \
27+
$DOCKER run \
2128
--rm \
22-
--user "$UID:$(id -g)" \
29+
"${user_args[@]}" \
2330
-e UID=$UID \
2431
-e COMPILE_MOBILE \
2532
-e SUBSERVER_PREFIX \

0 commit comments

Comments
 (0)