@@ -34,23 +34,41 @@ RUN apt-get update && apt-get install -y \
3434
3535# ------------------------------------------------------------------------------
3636# Create 'ubuntu' user if it doesn't exist (for Ubuntu 22.04 compatibility)
37+ #
38+ # Ubuntu 24.04 already includes this user; Ubuntu 22.04 does not.
39+ # UID/GID will be remapped at runtime by entrypoint.sh to match host.
40+ #
41+ # IMPORTANT: We hardcode 'ubuntu' to avoid UID conflicts:
42+ # - Ubuntu base images already have an 'ubuntu' user at UID 1000
43+ # - If we used a different username and tried to create it with UID 1000,
44+ # the 'useradd' command would fail due to UID conflict
45+ # - Runtime remapping (via usermod) changes the numeric UID/GID, not the name
46+ # - File permissions use numeric UIDs, so the username is just a label
3747# ------------------------------------------------------------------------------
3848RUN if ! id -u ubuntu > /dev/null 2>&1; then \
3949 useradd -m -s /bin/bash -u 1000 ubuntu; \
4050 fi
4151
4252# ------------------------------------------------------------------------------
43- # Configure the 'ubuntu' user (UID/GID will be remapped at runtime)
53+ # Configure sudo access for ubuntu user
4454# ------------------------------------------------------------------------------
4555RUN echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ubuntu \
4656 && chmod 0440 /etc/sudoers.d/ubuntu
4757
4858# ------------------------------------------------------------------------------
49- # Configure bash with colors for ubuntu user
59+ # Enable colored terminal prompts (OPTIONAL - forces colors unconditionally)
60+ #
61+ # Without TERM=xterm-256color (set in run.sh and devcontainer.json), TERM
62+ # defaults to "xterm" which lacks color support. Setting TERM=xterm-256color
63+ # enables Ubuntu's .bashrc auto-detection to recognize and use colors.
64+ #
65+ # Uncommenting the line below forces colors unconditionally, bypassing detection.
66+ # This ensures colors work even if TERM isn't properly set, or in non-interactive
67+ # contexts. Safe for modern environments like Ubuntu 22.04/24.04.
68+ #
69+ # Only downside: may show escape codes on very old terminals without color support.
5070# ------------------------------------------------------------------------------
51- RUN echo 'export PS1="\[\0 33[01;32m\]\u @\h\[\0 33[00m\] :\[\0 33[01;34m\]\w\[\0 33[00m\]\$ "' >> /home/ubuntu/.bashrc \
52- && echo 'alias ls="ls --color=auto"' >> /home/ubuntu/.bashrc \
53- && echo 'alias grep="grep --color=auto"' >> /home/ubuntu/.bashrc
71+ # RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /home/ubuntu/.bashrc
5472
5573# -----------------------------------------------------------------------------
5674# Install pre-commit for code quality checks
0 commit comments