File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ services:
176
176
# dockerfile: Dockerfile
177
177
image : ghcr.io/datadog/dd-trace-py/testrunner:8b69a2610342b333f8832422ffc4f3a9327bed13@sha256:c2d067947ffdb305fc7dc7ff1f8eb7035cfa110bd1199917dd2519eadd166402
178
178
command : bash
179
+ entrypoint : /project/scripts/ddtest-entrypoint.sh
179
180
environment :
180
181
DD_SETUP_CACHE_DOWNLOADS : " 1"
181
182
DD_CMAKE_INCREMENTAL_BUILD : " 1"
@@ -184,11 +185,11 @@ services:
184
185
CARGO_BUILD_JOBS : " 12"
185
186
network_mode : host
186
187
userns_mode : host
187
- working_dir : /root/ project/
188
+ working_dir : /project/
188
189
volumes :
189
190
- ddagent:/tmp/ddagent
190
- - ./:/root/ project
191
- - ./.riot:/root/ project/.riot
191
+ - ./:/project
192
+ - ./.riot:/project/.riot
192
193
193
194
localstack :
194
195
image : localstack/localstack:1.4.0
Original file line number Diff line number Diff line change 9
9
CMD=bash
10
10
fi
11
11
12
+ # Make UID and GID available to the testrunner container, to run with the same user as the host.
13
+ # The entrypoint at scripts/ddtest-entrypoint.sh will drop privileges to the user with the given UID and GID.
14
+ # This will ensure any file created on mounted volumes have the right ownership.
15
+ export EFFECTIVE_UID=$( id -u)
16
+ export EFFECTIVE_GID=$( id -g)
17
+
12
18
docker compose run \
13
19
-e DD_TRACE_AGENT_URL \
20
+ -e EFFECTIVE_UID \
21
+ -e EFFECTIVE_GID \
14
22
--rm \
15
23
-i \
16
24
testrunner \
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -eu
3
+
4
+ # If EFFECTIVE_UID, EFFECTIVE_GID are set, then create a user with that UID and GID
5
+ # and drop privileges to that user.
6
+ if [ -n " ${EFFECTIVE_UID:- } " ] && [ -n " ${EFFECTIVE_GID:- } " ]; then
7
+ groupadd -g " ${EFFECTIVE_GID} " user
8
+ useradd -u " ${EFFECTIVE_UID} " -g " ${EFFECTIVE_GID} " -m user
9
+ env
10
+ exec su - user -c " $@ "
11
+ fi
12
+
13
+ exec " $@ "
You can’t perform that action at this time.
0 commit comments