diff --git a/Dockerfile b/Dockerfile index 4da5577..d16e8d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,13 @@ FROM mcr.microsoft.com/devcontainers/php:8.3 +# The php base image sets WORKDIR to /var/www/html, which devcontainer_on_create.sh +# later deletes and replaces with a symlink to the mounted docroot. The devcontainer +# CLI starts its persistent setup shell ("shellServer") in WORKDIR with no -w flag, so +# that deletion orphans the shell's cwd and the subsequent dotfiles `git clone` fails +# with "Unable to read current working directory" (issue #45). Anchor WORKDIR to a +# stable directory that the lifecycle scripts never delete. +WORKDIR /home/vscode + # Change default umask and add user to web group so we can share write permission on web files # Configure pam_umask to set umask to 002 (works regardless of /etc/login.defs content) RUN sed -i 's/pam_umask\.so/pam_umask.so umask=002/' /etc/pam.d/common-session \ diff --git a/local/etc/uceap.d/devcontainer_on_create.sh b/local/etc/uceap.d/devcontainer_on_create.sh index afa5f3c..8d0ae42 100644 --- a/local/etc/uceap.d/devcontainer_on_create.sh +++ b/local/etc/uceap.d/devcontainer_on_create.sh @@ -93,9 +93,6 @@ function devcontainer_on_create() { if [ -x .devcontainer/onCreate.sh ]; then .devcontainer/onCreate.sh fi - - # Leave the shellServer with a valid cwd for any subsequent step (see issue #45) - cd "$WORKSPACE_FOLDER" } _devcontainer_on_create_desc='runs when the devcontainer is created' diff --git a/local/etc/uceap.d/devcontainer_post_create.sh b/local/etc/uceap.d/devcontainer_post_create.sh index 9090845..f8bba7c 100644 --- a/local/etc/uceap.d/devcontainer_post_create.sh +++ b/local/etc/uceap.d/devcontainer_post_create.sh @@ -29,9 +29,6 @@ function devcontainer_post_create() { if [ -x .devcontainer/postCreate.sh ]; then .devcontainer/postCreate.sh fi - - # Leave the shellServer with a valid cwd for any subsequent step (see issue #45) - cd "$WORKSPACE_FOLDER" } _devcontainer_post_create_desc='runs after the devcontainer is created'