File size: 2,738 Bytes
fdd8808 4078e96 9df9868 e9961f2 c66a91c 4078e96 e9ada35 fdd8808 c184d09 e9ada35 c66a91c 4078e96 fdd8808 e9961f2 4078e96 fdd8808 c66a91c c20f011 4078e96 e9961f2 2980a9c e9961f2 4078e96 ea79449 81c38f3 ea79449 a81edb5 ea79449 c184d09 2980a9c 83e723f fdd8808 83e723f e9ada35 c66a91c ea79449 fdd8808 c66a91c e9ada35 4078e96 e9ada35 e9961f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # Base Image (LTS version for maximum stability)
FROM ubuntu:22.04
# Environment Variables
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
# Install Core Professional Tools + Network Diagnostic Tools (net-tools, iproute2, lsof)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl wget git htop nano vim python3 python3-pip sudo zsh tmux unzip locales \
net-tools iproute2 lsof procps \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Web Terminal (ttyd) Setup - Silent and secure download
RUN wget -q https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 -O /usr/local/bin/ttyd \
&& chmod +x /usr/local/bin/ttyd
# Create User and Setup Sudo safely
RUN useradd -m -s /bin/zsh -u 1000 user \
&& echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER user
ENV HOME=/home/user
ENV PATH="/home/user/.local/bin:${PATH}"
WORKDIR $HOME/app
# ULTRA-FAST ZSH SETUP (No Oh-My-Zsh, zero lag, instant response)
RUN echo "autoload -U colors && colors" > ~/.zshrc \
&& echo "PROMPT=$'\n%{$fg[cyan]%}%~%{$reset_color%}\n%{$fg[green]%}❯%{$reset_color%} '" >> ~/.zshrc \
&& echo "alias ll='ls -alF'" >> ~/.zshrc \
&& echo "alias la='ls -A'" >> ~/.zshrc \
&& echo "alias l='ls -CF'" >> ~/.zshrc \
&& echo "clear" >> ~/.zshrc
# ZERO-LATENCY TMUX CONFIG (Mouse OFF for native text selection)
RUN echo 'set -g default-terminal "screen-256color"' > ~/.tmux.conf \
&& echo 'set -g mouse off' >> ~/.tmux.conf \
&& echo 'set -s escape-time 0' >> ~/.tmux.conf \
&& echo 'set -g history-limit 100000' >> ~/.tmux.conf \
&& echo 'set -g status-bg "#000000"' >> ~/.tmux.conf \
&& echo 'set -g status-fg "#ffffff"' >> ~/.tmux.conf \
&& echo 'set -g status-left-length 50' >> ~/.tmux.conf \
&& echo 'set -g status-left "#[fg=#ffffff,bg=#222222,bold] WORKSPACE [#S] #[bg=#000000] "' >> ~/.tmux.conf \
&& echo 'set -g status-right "#[fg=#888888]%Y-%m-%d #[fg=#ffffff]%H:%M "' >> ~/.tmux.conf \
&& echo 'set -g pane-border-style fg="#333333"' >> ~/.tmux.conf \
&& echo 'set -g pane-active-border-style fg="#555555",bg=default' >> ~/.tmux.conf
# 🚀 OPTIMIZATION: Copy requirements first to leverage Docker Layer Caching
COPY --chown=user:user requirements.txt $HOME/app/
# Safely install Python Requirements
RUN if grep -q '^[^#[:space:]]' requirements.txt; then \
pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt; \
else \
echo "No active python packages found to install."; \
fi
# Copy the rest of the project files
COPY --chown=user:user . $HOME/app
# Port for ttyd or FastAPI
EXPOSE 7860
# Default execution command
CMD ["python3", "app.py"] |