mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-24 16:05:07 +03:00
Refactor Dockerfile to enhance Oh My Zsh installation and configuration for improved terminal experience
This commit is contained in:
parent
4acc41cc03
commit
170e369a53
2 changed files with 52 additions and 9 deletions
|
@ -11,9 +11,6 @@ RUN apt-get update && apt-get install -y \
|
|||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Oh My Zsh for better terminal experience
|
||||
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended
|
||||
|
||||
# Install essential Go development tools only
|
||||
RUN go install golang.org/x/tools/gopls@latest \
|
||||
&& go install github.com/go-delve/delve/cmd/dlv@latest \
|
||||
|
@ -47,15 +44,24 @@ RUN chown $USERNAME:$USERNAME /workspace
|
|||
COPY go.mod go.sum ./
|
||||
RUN go mod download && chown -R $USERNAME:$USERNAME /workspace
|
||||
|
||||
# Install Oh My Zsh for better terminal experience
|
||||
RUN sh -c "ZSH=/usr/local/share/zsh/oh-my-zsh $(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended \
|
||||
&& ZSH_CUSTOM=/usr/local/share/zsh/oh-my-zsh/custom \
|
||||
&& git clone https://github.com/chrissicool/zsh-256color $ZSH_CUSTOM/plugins/zsh-256color \
|
||||
&& git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions \
|
||||
&& git clone https://github.com/popstas/zsh-command-time.git $ZSH_CUSTOM/plugins/command-time
|
||||
|
||||
# Setup zshrc
|
||||
COPY contrib/docker/devcontainer/zshrc /usr/local/share/zsh/.zshrc
|
||||
RUN rm -f /root/.zshrc \
|
||||
&& ln -s /usr/local/share/zsh/.zshrc /root/.zshrc \
|
||||
&& ln -s /usr/local/share/zsh/.zshrc /home/vscode/.zshrc
|
||||
|
||||
# Set up shell environment for vscode user
|
||||
USER $USERNAME
|
||||
|
||||
# Set up shell environment for vscode user
|
||||
ENV SHELL=/bin/zsh
|
||||
RUN echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.zshrc \
|
||||
&& echo 'export GO111MODULE=on' >> ~/.zshrc \
|
||||
&& echo 'export LANG=C.UTF-8' >> ~/.zshrc \
|
||||
&& echo 'export LC_ALL=C.UTF-8' >> ~/.zshrc \
|
||||
&& echo 'export LC_CTYPE=C.UTF-8' >> ~/.zshrc \
|
||||
&& mkdir -p ~/.cache
|
||||
|
||||
# Expose common ports that might be used by Yggdrasil
|
||||
EXPOSE 9001 9002 9003
|
||||
|
|
37
contrib/docker/devcontainer/zshrc
Normal file
37
contrib/docker/devcontainer/zshrc
Normal file
|
@ -0,0 +1,37 @@
|
|||
export ZSH="/usr/local/share/zsh/oh-my-zsh"
|
||||
|
||||
ZSH_THEME="agnoster"
|
||||
CASE_SENSITIVE="true"
|
||||
zstyle ':omz:update' mode disabled # disable automatic updates
|
||||
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
HIST_STAMPS="mm/dd/yyyy"
|
||||
plugins=(git zsh-256color zsh-autosuggestions command-time sudo)
|
||||
|
||||
ZSH_DISABLE_COMPFIX=true
|
||||
ZSH_CACHE_DIR="$HOME/.cache/ohmyzsh"
|
||||
ZSH_COMPDUMP="${ZSH_CACHE_DIR}/.zcompdump-${HOST/.*/}-${ZSH_VERSION}"
|
||||
mkdir -p "$ZSH_CACHE_DIR"
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
alias zshconfig="mate ~/.zshrc"
|
||||
alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
|
||||
prompt_context() {
|
||||
_bg=043
|
||||
[[ $UID -eq 0 ]] && _bg=202
|
||||
prompt_segment $_bg $CURRENT_FG "%m"
|
||||
}
|
||||
|
||||
prompt_status() {
|
||||
local -a symbols
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
||||
}
|
||||
|
||||
export PATH=$PATH:$(go env GOPATH 2>/dev/null)/bin
|
||||
export GO111MODULE=on
|
||||
export LANG=C.UTF-8
|
||||
export LC_ALL=C.UTF-8
|
||||
export LC_CTYPE=C.UTF-8
|
Loading…
Add table
Add a link
Reference in a new issue