Skip to content

Fix: remove login shell from CMD to prevent spurious /home/www/.vscode-server creation#54

Merged
darrenoh merged 4 commits intomainfrom
copilot/fix-vscode-server-directory-issue
Mar 22, 2026
Merged

Fix: remove login shell from CMD to prevent spurious /home/www/.vscode-server creation#54
darrenoh merged 4 commits intomainfrom
copilot/fix-vscode-server-directory-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

  • Fix Dockerfile: change CMD ["/bin/bash", "-lc", "$BASE_CMD"] to CMD ["/bin/bash", "-c", "$BASE_CMD"] to stop login shell from sourcing profile scripts that create /home/www/.vscode-server
  • Update CMD comment: correct wording — directory is created in the container's writable layer at initial startup, not during docker build
  • Add static test to docker-build-test.sh: verify /home/www/.vscode-server is absent from the final image
  • Add runtime test to docker-build-test.sh: verify /home/www/.vscode-server is absent in a running container started with the default CMD
  • Fix spelling: change British "initialise/initialisation" to US "initialize/initialization" throughout Dockerfile and docker-build-test.sh

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… Server init

The CMD used `bash -lc "$BASE_CMD"`. The -l flag starts a login shell that
sources /etc/profile and user profile scripts. The DevPanel base image profile
scripts initialise VS Code Server, which is configured to use $APP_ROOT/.vscode
as its user data directory. APP_ROOT is injected at runtime by DevPanel and is
not available during a login-shell execution at build/start time, so VS Code
Server falls back to its default home path (/home/www/.vscode-server).

Fix: use `bash -c` (no -l). $BASE_CMD is an ENV variable available in any shell
context; a login shell is not required for variable expansion.

Add two assertions to docker-build-test.sh:
- Static check: /home/www/.vscode-server absent from image layers
- Runtime check: /home/www/.vscode-server absent in running container

Co-authored-by: darrenoh <2293701+darrenoh@users.noreply.github.com>
Agent-Logs-Url: https://github.com/drupalforge/deployment/sessions/229084c7-0f9a-49da-9f39-8afeee42f848
Copilot AI changed the title [WIP] Fix issue with vscode-server directory creation Fix: remove login shell from CMD to prevent spurious /home/www/.vscode-server creation Mar 22, 2026
Copilot AI requested a review from darrenoh March 22, 2026 15:20
@darrenoh darrenoh requested a review from Copilot March 22, 2026 15:22
@darrenoh darrenoh marked this pull request as ready for review March 22, 2026 15:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the deployment image’s default startup command to avoid running a login shell, preventing DevPanel base-image profile scripts from initializing VS Code Server before APP_ROOT is injected and thereby avoiding creation of /home/www/.vscode-server.

Changes:

  • Update Dockerfile CMD to use bash -c instead of bash -lc.
  • Extend tests/docker-build-test.sh to assert /home/www/.vscode-server is absent both in a fresh container filesystem (image state) and after starting with the default CMD.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Dockerfile Switch default CMD away from login shell and document why.
tests/docker-build-test.sh Add checks ensuring .vscode-server is not present in the built image or created during default startup.

@darrenoh
Copy link
Member

@copilot apply changes based on the comments in this thread

…not during build

- Dockerfile: replace "triggered by docker build or the first container start" /
  "baking it into the container" with accurate language: the directory is created
  in the container's writable layer when a login shell runs before APP_ROOT is set
  (i.e. at initial container startup)
- docker-build-test.sh: change "image layers" / "baked into the image" to
  "final image" per review feedback

Co-authored-by: darrenoh <2293701+darrenoh@users.noreply.github.com>
Agent-Logs-Url: https://github.com/drupalforge/deployment/sessions/3c4d7459-cd62-4db5-b12d-f3613affd28c
Copy link
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot apply changes based on the comments in this thread

Applied in f2191c7 — Dockerfile comment now reads "when a login shell runs before APP_ROOT has been set (for example, at initial container startup)" and "creating that directory in the container's writable layer", and the test wording has been updated to "final image".

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

@darrenoh
Copy link
Member

@copilot apply changes based on the comments in this thread

…US spelling)

Consistent with the rest of the repo (US English). Fixes all occurrences in
Dockerfile and tests/docker-build-test.sh.

Co-authored-by: darrenoh <2293701+darrenoh@users.noreply.github.com>
Agent-Logs-Url: https://github.com/drupalforge/deployment/sessions/9461a099-f6d0-43fd-a33c-2d9887eb5ab2
Copy link
Contributor Author

Copilot AI commented Mar 22, 2026

@copilot apply changes based on the comments in this thread

Done in a90ca3d — changed all instances of "initialise/initialisation/initialising" to "initialize/initialization/initializing" in both Dockerfile and tests/docker-build-test.sh.

Copilot AI requested a review from darrenoh March 22, 2026 15:38
@darrenoh darrenoh requested a review from Copilot March 22, 2026 15:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@darrenoh darrenoh merged commit caaf2e8 into main Mar 22, 2026
7 checks passed
@darrenoh darrenoh deleted the copilot/fix-vscode-server-directory-issue branch March 22, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants