Fixed issues with setting up colored Bash prompt supporting displaying Git repository information.
All checks were successful
Build Docker Image / build (push) Successful in 38s
All checks were successful
Build Docker Image / build (push) Successful in 38s
This commit is contained in:
27
Dockerfile
27
Dockerfile
@@ -22,33 +22,18 @@ RUN apt-get update && apt-get install -y azure-cli
|
||||
RUN apt-get install -y zip unzip tree wget nano neovim \
|
||||
python3 python3-venv python3-pip
|
||||
|
||||
# Configure Bash
|
||||
RUN cat <<'EOF' >> /etc/profile.d/git-prompt-helper
|
||||
# Include Git prompt helpers if available
|
||||
if [ -f /usr/lib/git-core/git-sh-prompt ]; then
|
||||
source /usr/lib/git-core/git-sh-prompt
|
||||
|
||||
# Then PS1 can include __git_ps1 which is optimized and shows branch + state:
|
||||
PS1='\[\e[32m\]AzureCLI (\[\e[35m\]${ACCOUNT_NAME}\[\e[0m\])\n\[\e[0m\]\[\e[34m\]\w\[\e[0m\]\[\e[33m\]$(__git_ps1 " (%s)")\[\e[0m\]\$ '
|
||||
fi
|
||||
|
||||
export PATH=$HOME/bin:$PATH
|
||||
EOF
|
||||
COPY enable-git-bash-prompt /usr/local/bin/enable-git-bash-prompt
|
||||
|
||||
# Patch the default .bashrc to enable git bash prompt
|
||||
RUN cat <<'EOF' >> /etc/skel/.bashrc
|
||||
|
||||
if ! command -v __git_ps1 > /dev/null; then
|
||||
source /etc/profile.d/git-prompt-helper
|
||||
fi
|
||||
EOF
|
||||
|
||||
RUN cat <<'EOF' >> /home/ubuntu/.bashrc
|
||||
if ! command -v __git_ps1 > /dev/null; then
|
||||
source /etc/profile.d/git-prompt-helper
|
||||
# Enable git bash prompt
|
||||
if [ -f /usr/local/bin/enable-git-bash-prompt ]; then
|
||||
source /usr/local/bin/enable-git-bash-prompt
|
||||
fi
|
||||
EOF
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user