Improve DX for devcontainer and docker compose based workflows - #153
Draft
waxlamp wants to merge 2 commits into
Draft
Improve DX for devcontainer and docker compose based workflows#153waxlamp wants to merge 2 commits into
waxlamp wants to merge 2 commits into
Conversation
The directive to reset the port forwarding for the Django container
relies on the VSCode devcontainer extension to perform dynamic port
forwarding, but that leaves a devcontainer CLI runtime with no way to
forward the Django service port to the host. In addition, keeping the
static forwarding for this service does not harm the VSCode devcontainer
UX at all, as that port is forwarded statically, while any others that
arise will be forwarded dynamically.
Furthermore, the comment on the line that resets Django port forwarding
notes that devcontainer forwarding is better since it is localhost-only;
the other change in this commit is to weaken the docker-compose level
port forwarding to explicitly bind to localhost on the host only, rather
than the default of 0.0.0.0 ("all interfaces"). This prevents those
services from being accessible across the local network (and brings it
into line with the devcontainer approach).
This aligns the `vscode` user in the container to have the same UID and GID as the user on the host. It requires a bit of manual intervention, but not doing that step will lead to incorrect behavior, and the manual step can be done at that point, followed by a container rebuild. That is to say, the situation is near-self-healing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains some experimental changes to improve correctness and usability of both the Docker Compose and Dev Container based development workflows. The following changes have been made (but see the commit messages for further detail):
localhostexplicitly, preventing access to those services by default from other hosts on the network.vscodeuser in the Docker Compose setup, preventing both permission problems on startup, and the need to run the containers as root.These changes do not impact the Dev Container setup, which will continue to take advantage of VSCode's various facilities to support this workflow (including, e.g., dynamic port forwarding for services launched during the dev container's lifetime). They just make the Docker Compose workflow work better, and they enable the use of the standalone
devcontainerCLI.TODO: