-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlaunchcontainer
More file actions
executable file
·29 lines (24 loc) · 923 Bytes
/
launchcontainer
File metadata and controls
executable file
·29 lines (24 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh -x
if [ -z "$DOCKER_IMAGE" ]; then
DOCKER_IMAGE="pavics/workflow-tests:py312-260415"
fi
if [ -z "$CONTAINER_NAME" ]; then
CONTAINER_NAME="birdy"
fi
# allow directly running another command with the launched docker
# (eg: CONTAINER_CMD=testall launchcontainer)
# otherwise, start interactive shell
if [ -z "${CONTAINER_CMD}" ]; then
CONTAINER_CMD=/bin/bash
fi
USER_ID="$(id -u)"
GROUP_ID="$(id -g)"
# launch with current user UID and GID to not have write permission problems
docker run -it --rm --name $CONTAINER_NAME \
-v "$(pwd)":"$(pwd)" -u 0:0 -w "$(pwd)" --hostname "$(hostname -f)" \
$DOCKER_RUN_OPTS \
$DOCKER_IMAGE \
bash -c "groupmod -g $GROUP_ID jenkins; \
usermod -u $USER_ID jenkins; \
echo 'ENV_PATH PATH=/usr/local/envs/birdy/bin:/opt/conda/bin:/usr/local/bin:/usr/bin:/bin' >> /etc/login.defs; \
su jenkins -s ${CONTAINER_CMD}"