docker-space-demo / Dockerfile
raw9
🚀 Super Advanced Terminal v2.0 - Full upgrade with Zsh, Powerlevel10k, modern CLI tools, multi-language runtimes, VS Code Server, Nginx, and Tokyo Night theme
bfdfb83
Raw
History Blame Contribute Delete
9.48 kB
# ============================================
# Super Advanced Linux Terminal v2.0
# Hugging Face Docker Space
# ============================================
FROM ubuntu:22.04
# Avoid prompts during build
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV TERM=xterm-256color
ENV COLORTERM=truecolor
# ============================================
# Stage 1: System packages
# ============================================
RUN apt-get update && apt-get install -y --no-install-recommends \
# Core tools
sudo curl wget git unzip zip tar gzip bzip2 xz-utils \
ca-certificates gnupg lsb-release software-properties-common \
# Build essentials
build-essential gcc g++ make cmake pkg-config \
# Shell & terminal
zsh tmux screen \
# Editors
neovim nano \
# System monitoring
htop ncdu mtr-tiny iproute2 net-tools dnsutils iputils-ping \
# Dev tools
jq openssh-client rsync \
# Nginx
nginx \
# Python
python3 python3-pip python3-venv python3-dev \
# Libraries for various tools
libssl-dev libffi-dev \
# Locale
locales \
&& locale-gen en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
# ============================================
# Stage 2: Modern CLI tools (from GitHub releases)
# ============================================
# ttyd - Web terminal
RUN wget -qO /usr/local/bin/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 \
&& chmod +x /usr/local/bin/ttyd
# bat - Better cat
RUN wget -qO /tmp/bat.deb https://github.com/sharkdp/bat/releases/download/v0.24.0/bat_0.24.0_amd64.deb \
&& dpkg -i /tmp/bat.deb && rm /tmp/bat.deb
# eza - Better ls (with icons)
RUN wget -qO /tmp/eza.tar.gz https://github.com/eza-community/eza/releases/download/v0.20.13/eza_x86_64-unknown-linux-gnu.tar.gz \
&& tar -xzf /tmp/eza.tar.gz -C /usr/local/bin/ && chmod +x /usr/local/bin/eza && rm /tmp/eza.tar.gz
# ripgrep - Better grep
RUN wget -qO /tmp/rg.deb https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep_14.1.1-1_amd64.deb \
&& dpkg -i /tmp/rg.deb && rm /tmp/rg.deb
# fd - Better find
RUN wget -qO /tmp/fd.deb https://github.com/sharkdp/fd/releases/download/v10.2.0/fd_10.2.0_amd64.deb \
&& dpkg -i /tmp/fd.deb && rm /tmp/fd.deb
# dust - Better du
RUN wget -qO /tmp/dust.deb https://github.com/bootandy/dust/releases/download/v1.1.1/du-dust_1.1.1-1_amd64.deb \
&& dpkg -i /tmp/dust.deb && rm /tmp/dust.deb
# procs - Better ps
RUN wget -qO /tmp/procs.zip https://github.com/dalance/procs/releases/download/v0.14.8/procs-v0.14.8-x86_64-linux.zip \
&& unzip -o /tmp/procs.zip -d /usr/local/bin/ && chmod +x /usr/local/bin/procs && rm /tmp/procs.zip
# btop - Beautiful resource monitor
RUN wget -qO /tmp/btop.tbz https://github.com/aristocratos/btop/releases/download/v1.4.0/btop-x86_64-linux-musl.tbz \
&& tar -xjf /tmp/btop.tbz -C /tmp/ && cp /tmp/btop/bin/btop /usr/local/bin/ && chmod +x /usr/local/bin/btop && rm -rf /tmp/btop*
# delta - Better git diff
RUN wget -qO /tmp/delta.deb https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_amd64.deb \
&& dpkg -i /tmp/delta.deb && rm /tmp/delta.deb
# zoxide - Smart cd
RUN wget -qO /tmp/zoxide.deb https://github.com/ajeetdsouza/zoxide/releases/download/v0.9.6/zoxide_0.9.6-1_amd64.deb \
&& dpkg -i /tmp/zoxide.deb && rm /tmp/zoxide.deb
# fzf - Fuzzy finder
RUN wget -qO /tmp/fzf.tar.gz https://github.com/junegunn/fzf/releases/download/v0.57.0/fzf-0.57.0-linux_amd64.tar.gz \
&& tar -xzf /tmp/fzf.tar.gz -C /usr/local/bin/ && chmod +x /usr/local/bin/fzf && rm /tmp/fzf.tar.gz
# lazygit - TUI git client
RUN wget -qO /tmp/lazygit.tar.gz https://github.com/jesseduffield/lazygit/releases/download/v0.44.1/lazygit_0.44.1_Linux_x86_64.tar.gz \
&& tar -xzf /tmp/lazygit.tar.gz -C /usr/local/bin/ lazygit && chmod +x /usr/local/bin/lazygit && rm /tmp/lazygit.tar.gz
# yq - YAML processor
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.44.6/yq_linux_amd64 \
&& chmod +x /usr/local/bin/yq
# GitHub CLI
RUN wget -qO /tmp/gh.tar.gz https://github.com/cli/cli/releases/download/v2.63.2/gh_2.63.2_linux_amd64.tar.gz \
&& tar -xzf /tmp/gh.tar.gz -C /tmp/ && cp /tmp/gh_2.63.2_linux_amd64/bin/gh /usr/local/bin/ \
&& chmod +x /usr/local/bin/gh && rm -rf /tmp/gh*
# httpie - Better curl
RUN pip3 install --no-cache-dir --break-system-packages httpie
# ============================================
# Stage 3: Language runtimes
# ============================================
# Node.js 20 LTS
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn pnpm \
&& rm -rf /var/lib/apt/lists/*
# Go 1.22
RUN wget -qO /tmp/go.tar.gz https://go.dev/dl/go1.22.10.linux-amd64.tar.gz \
&& tar -xzf /tmp/go.tar.gz -C /usr/local/ && rm /tmp/go.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
# ============================================
# Stage 4: VS Code Server (code-server)
# ============================================
RUN curl -fsSL https://code-server.dev/install.sh | sh
# ============================================
# Stage 5: User setup
# ============================================
RUN useradd -m -s /bin/zsh -u 1000 user \
&& echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user \
&& chmod 0440 /etc/sudoers.d/user
USER user
ENV HOME=/home/user
ENV SHELL=/bin/zsh
ENV PATH=$PATH:/usr/local/go/bin:$HOME/go/bin:$HOME/.cargo/bin:$HOME/.local/bin
WORKDIR $HOME
# ============================================
# Stage 6: Zsh + Oh My Zsh + Powerlevel10k
# ============================================
# Oh My Zsh
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# Powerlevel10k theme
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# zsh-autosuggestions
RUN git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# zsh-syntax-highlighting
RUN git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Rust (rustup for user)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# ============================================
# Stage 7: Copy config files
# ============================================
COPY --chown=user:user config/.zshrc $HOME/.zshrc
COPY --chown=user:user config/.tmux.conf $HOME/.tmux.conf
COPY --chown=user:user config/.p10k.zsh $HOME/.p10k.zsh
COPY --chown=user:user config/motd.sh $HOME/motd.sh
COPY --chown=user:user start.sh $HOME/start.sh
COPY --chown=user:user nginx.conf /etc/nginx/nginx.conf
RUN chmod +x $HOME/start.sh $HOME/motd.sh
# Create workspace
RUN mkdir -p $HOME/workspace
# Git config
RUN git config --global init.defaultBranch main \
&& git config --global core.editor nvim \
&& git config --global core.pager delta \
&& git config --global delta.navigate true \
&& git config --global delta.line-numbers true \
&& git config --global delta.side-by-side true \
&& git config --global interactive.diffFilter "delta --color-only" \
&& git config --global merge.conflictstyle diff3
# Create help command
RUN echo '#!/bin/bash\n\
echo ""\n\
echo " \033[1;36m\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Quick Commands \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mlg\033[0m LazyGit TUI \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mbtop\033[0m Resource Monitor \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mlt\033[0m Tree View (2 levels) \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mll\033[0m Detailed File List \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mcat\033[0m Syntax-highlighted view \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mrg\033[0m Ultra-fast search \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mfd\033[0m Fast file finder \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mz <dir>\033[0m Smart jump \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mhttp\033[0m HTTPie client \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mgh\033[0m GitHub CLI \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mweather\033[0m Weather info \033[36m\u2551\033[0m"\n\
echo " \033[36m\u2551\033[0m \033[33mmyip\033[0m Show public IP \033[36m\u2551\033[0m"\n\
echo " \033[1;36m\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\033[0m"\n\
echo ""' > $HOME/.local/bin/help-me \
&& chmod +x $HOME/.local/bin/help-me
# Ensure .local/bin exists and is in PATH
RUN mkdir -p $HOME/.local/bin
EXPOSE 7860
CMD ["/home/user/start.sh"]