File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ FROM python:3.12-slim as runtime
3333WORKDIR /app
3434
3535ENV RUN_AS_DEVIN=true
36- ENV OPENDEVIN_USER_ID=1000
36+ # A random number--we need this to be different from the user's UID on the host machine
37+ ENV OPENDEVIN_USER_ID=42420
3738ENV USE_HOST_NETWORK=false
3839ENV SSH_HOSTNAME=host.docker.internal
3940ENV WORKSPACE_BASE=/opt/workspace_base
Original file line number Diff line number Diff line change @@ -10,9 +10,23 @@ if [ -z "$SANDBOX_USER_ID" ]; then
1010 exit 1
1111fi
1212
13+ if [[ " $SANDBOX_USER_ID " -eq 0 ]]; then
14+ echo " SANDBOX_USER_ID cannot be 0. Please run with a different user id."
15+ exit 1
16+ fi
17+
1318# change uid of opendevin user to match the host user
1419# but the group id is not changed, so the user can still access everything under /app
15- useradd -l -m -u $SANDBOX_USER_ID -s /bin/bash enduser
20+ if ! useradd -l -m -u $SANDBOX_USER_ID -s /bin/bash enduser; then
21+ echo " Failed to create user enduser with id $SANDBOX_USER_ID . Moving opendevin user."
22+ incremented_id=$(( $SANDBOX_USER_ID + 1 ))
23+ usermod -u $incremented_id opendevin
24+ if ! useradd -l -m -u $SANDBOX_USER_ID -s /bin/bash enduser; then
25+ echo " Failed to create user enduser with id $SANDBOX_USER_ID for a second time. Exiting."
26+ exit 1
27+ fi
28+ fi
29+
1630usermod -aG app enduser
1731mkdir -p /home/enduser/.cache/ms-playwright/
1832mv /home/opendevin/.cache/ms-playwright/ /home/enduser/.cache/
You can’t perform that action at this time.
0 commit comments