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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
+
|
| 5 |
+
# -----------------------------
|
| 6 |
+
# Core tools + Build Essentials
|
| 7 |
+
# -----------------------------
|
| 8 |
+
# Add apt-fast without interactive config
|
| 9 |
+
RUN apt-get update && apt-get install -y software-properties-common \
|
| 10 |
+
&& add-apt-repository -y ppa:apt-fast/stable \
|
| 11 |
+
&& apt-get update \
|
| 12 |
+
&& DEBIAN_FRONTEND=noninteractive \
|
| 13 |
+
apt-get -y install apt-fast \
|
| 14 |
+
&& echo "DOWNLOADBEFORE=true" | tee -a /etc/apt-fast.conf \
|
| 15 |
+
&& echo "MAXNUM=20" | tee -a /etc/apt-fast.conf \
|
| 16 |
+
&& echo "USE_PIGZ=1" | tee -a /etc/apt-fast.conf \
|
| 17 |
+
&& echo "APTFAST_PARA_OPTS=(--max-connection-per-server=12 --split=5)" | tee -a /etc/apt-fast.conf
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
RUN apt-fast update && apt-fast install -y \
|
| 21 |
+
curl wget git git-lfs unzip sudo nano bash apt-fast \
|
| 22 |
+
software-properties-common ca-certificates gnupg \
|
| 23 |
+
build-essential g++ gfortran \
|
| 24 |
+
cmake ninja-build pkg-config \
|
| 25 |
+
llvm clang lld lldb \
|
| 26 |
+
valgrind gdb strace ltrace \
|
| 27 |
+
htop tree jq sqlite3 \
|
| 28 |
+
net-tools iputils-ping \
|
| 29 |
+
rsync git-extras pigz \
|
| 30 |
+
fzf silversearcher-ag ripgrep mingw-w64 \
|
| 31 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 32 |
+
|
| 33 |
+
RUN git lfs install
|
| 34 |
+
|
| 35 |
+
# -----------------------------
|
| 36 |
+
# Python 3.12
|
| 37 |
+
# -----------------------------
|
| 38 |
+
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-fast update
|
| 39 |
+
RUN apt-fast install -y python3.12 python3.12-venv python3.12-dev \
|
| 40 |
+
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
|
| 41 |
+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 \
|
| 42 |
+
&& update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.12 1
|
| 43 |
+
RUN update-alternatives --set python3 /usr/bin/python3.12
|
| 44 |
+
|
| 45 |
+
# -----------------------------
|
| 46 |
+
# Rust (global)
|
| 47 |
+
# -----------------------------
|
| 48 |
+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --no-modify-path \
|
| 49 |
+
&& mv /root/.cargo /usr/local/cargo \
|
| 50 |
+
&& mv /root/.rustup /usr/local/rustup \
|
| 51 |
+
&& ln -s /usr/local/cargo/bin/* /usr/local/bin/ \
|
| 52 |
+
&& rm -rf /root/.cargo /root/.rustup
|
| 53 |
+
ENV RUSTUP_HOME=/usr/local/rustup
|
| 54 |
+
ENV CARGO_HOME=/usr/local/cargo
|
| 55 |
+
ENV PATH=/usr/local/cargo/bin:$PATH
|
| 56 |
+
|
| 57 |
+
# -----------------------------
|
| 58 |
+
# Go (latest stable)
|
| 59 |
+
# -----------------------------
|
| 60 |
+
RUN curl -LO https://go.dev/dl/go1.23.0.linux-amd64.tar.gz \
|
| 61 |
+
&& tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz \
|
| 62 |
+
&& rm go1.23.0.linux-amd64.tar.gz
|
| 63 |
+
ENV PATH=/usr/local/go/bin:$PATH
|
| 64 |
+
|
| 65 |
+
# -----------------------------
|
| 66 |
+
# Node.js + Java + .NET
|
| 67 |
+
# -----------------------------
|
| 68 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 69 |
+
&& apt-fast install -y nodejs
|
| 70 |
+
RUN apt-fast install -y openjdk-17-jdk
|
| 71 |
+
RUN wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
|
| 72 |
+
&& dpkg -i packages-microsoft-prod.deb \
|
| 73 |
+
&& rm packages-microsoft-prod.deb \
|
| 74 |
+
&& apt-fast update && apt-fast install -y dotnet-sdk-8.0
|
| 75 |
+
|
| 76 |
+
# Yarn + Pnpm build tools
|
| 77 |
+
RUN npm install -g yarn pnpm
|
| 78 |
+
|
| 79 |
+
# -----------------------------
|
| 80 |
+
# Haskell
|
| 81 |
+
# -----------------------------
|
| 82 |
+
RUN apt-fast update && apt-fast install -y ghc cabal-install && rm -rf /var/lib/apt/lists/*
|
| 83 |
+
|
| 84 |
+
# -----------------------------
|
| 85 |
+
# Julia
|
| 86 |
+
# -----------------------------
|
| 87 |
+
RUN JULIA_VERSION=1.11.3 \
|
| 88 |
+
&& wget https://julialang-s3.julialang.org/bin/linux/x64/1.11/julia-$JULIA_VERSION-linux-x86_64.tar.gz \
|
| 89 |
+
&& tar -xzf julia-$JULIA_VERSION-linux-x86_64.tar.gz -C /opt/ \
|
| 90 |
+
&& ln -s /opt/julia-$JULIA_VERSION/bin/julia /usr/local/bin/julia \
|
| 91 |
+
&& rm julia-$JULIA_VERSION-linux-x86_64.tar.gz
|
| 92 |
+
|
| 93 |
+
# -----------------------------
|
| 94 |
+
# Scala + sbt
|
| 95 |
+
# -----------------------------
|
| 96 |
+
# Install dependencies
|
| 97 |
+
RUN apt-fast update && apt-fast install -y curl gnupg software-properties-common apt-transport-https && rm -rf /var/lib/apt/lists/*
|
| 98 |
+
|
| 99 |
+
# Add SBT repository and key
|
| 100 |
+
RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x99E82A75642AC823" | gpg --dearmor | tee /usr/share/keyrings/sbt.gpg > /dev/null \
|
| 101 |
+
&& echo "deb [signed-by=/usr/share/keyrings/sbt.gpg] https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list \
|
| 102 |
+
&& echo "deb [signed-by=/usr/share/keyrings/sbt.gpg] https://repo.scala-sbt.org/scalasbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list
|
| 103 |
+
|
| 104 |
+
# Install Scala + SBT
|
| 105 |
+
RUN apt-fast update && apt-fast install -y scala sbt && rm -rf /var/lib/apt/lists/*
|
| 106 |
+
|
| 107 |
+
# -----------------------------
|
| 108 |
+
# PHP + Composer
|
| 109 |
+
# -----------------------------
|
| 110 |
+
RUN apt-fast update && apt-fast install -y php-cli unzip \
|
| 111 |
+
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && rm -rf /var/lib/apt/lists/*
|
| 112 |
+
|
| 113 |
+
# -----------------------------
|
| 114 |
+
# Ruby
|
| 115 |
+
# -----------------------------
|
| 116 |
+
RUN apt-fast update && apt-fast install -y ruby-full && rm -rf /var/lib/apt/lists/*
|
| 117 |
+
|
| 118 |
+
# -----------------------------
|
| 119 |
+
# code-server
|
| 120 |
+
# -----------------------------
|
| 121 |
+
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 122 |
+
|
| 123 |
+
# -----------------------------
|
| 124 |
+
# Workspace + scripts
|
| 125 |
+
# -----------------------------
|
| 126 |
+
WORKDIR /home/vscode
|
| 127 |
+
RUN mkdir -p /home/vscode/workspace
|
| 128 |
+
COPY restore.py /restore.py
|
| 129 |
+
COPY app.py /app.py
|
| 130 |
+
COPY backup.py /home/backup.py
|
| 131 |
+
RUN chmod -R 777 /home
|
| 132 |
+
|
| 133 |
+
# -----------------------------
|
| 134 |
+
# Finishing touches -- you can comment these if not needed
|
| 135 |
+
# -----------------------------
|
| 136 |
+
# pip packages - dev/machine learning/AI
|
| 137 |
+
RUN pip install --upgrade pip setuptools wheel \
|
| 138 |
+
&& pip install black flake8 mypy jupyterlab ipython notebook
|
| 139 |
+
|
| 140 |
+
# more pip packages - for Hugging Face Hub
|
| 141 |
+
RUN pip install huggingface_hub huggingface_hub[cli] hf_xet hf_transfer
|
| 142 |
+
ENV HF_HUB_ENABLE_HF_TRANSFER=1
|
| 143 |
+
|
| 144 |
+
# even more pip packages - full-stack ML
|
| 145 |
+
RUN pip install numpy scipy pandas matplotlib seaborn scikit-learn \
|
| 146 |
+
jupyter jupyterlab \
|
| 147 |
+
torch torchvision torchaudio \
|
| 148 |
+
tensorflow keras \
|
| 149 |
+
datasets transformers accelerate
|
| 150 |
+
|
| 151 |
+
# Node tools
|
| 152 |
+
RUN npm install -g typescript ts-node nodemon
|
| 153 |
+
|
| 154 |
+
# Locales to prevent Unicode issues
|
| 155 |
+
RUN apt-fast update && apt-fast install -y locales \
|
| 156 |
+
&& locale-gen en_US.UTF-8 \
|
| 157 |
+
&& update-locale LANG=en_US.UTF-8
|
| 158 |
+
ENV LANG=en_US.UTF-8
|
| 159 |
+
ENV LANGUAGE=en_US:en
|
| 160 |
+
ENV LC_ALL=en_US.UTF-8
|
| 161 |
+
|
| 162 |
+
# Database Clients
|
| 163 |
+
RUN apt-fast update && apt-fast install -y \
|
| 164 |
+
mysql-client \
|
| 165 |
+
postgresql-client \
|
| 166 |
+
redis-tools \
|
| 167 |
+
gnupg wget ca-certificates \
|
| 168 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 169 |
+
|
| 170 |
+
# Install MongoDB Database Tools (mongo, mongodump, etc.)
|
| 171 |
+
RUN wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb.gpg \
|
| 172 |
+
&& echo "deb [signed-by=/usr/share/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" \
|
| 173 |
+
| tee /etc/apt/sources.list.d/mongodb-org-7.0.list \
|
| 174 |
+
&& apt-fast update && apt-fast install -y mongodb-database-tools \
|
| 175 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 176 |
+
|
| 177 |
+
# More build tools
|
| 178 |
+
RUN apt-fast update && apt-fast install -y \
|
| 179 |
+
autoconf automake libtool m4 \
|
| 180 |
+
ninja-build \
|
| 181 |
+
nasm yasm \
|
| 182 |
+
graphviz doxygen && rm -rf /var/lib/apt/lists/*
|
| 183 |
+
|
| 184 |
+
# Productivity + Debug
|
| 185 |
+
RUN apt-fast update && apt-fast install -y \
|
| 186 |
+
tmux screen neovim \
|
| 187 |
+
httpie \
|
| 188 |
+
shellcheck \
|
| 189 |
+
man-db manpages-dev && rm -rf /var/lib/apt/lists/*
|
| 190 |
+
|
| 191 |
+
# Removing cache
|
| 192 |
+
RUN apt-fast clean
|
| 193 |
+
RUN pip cache purge
|
| 194 |
+
|
| 195 |
+
# -----------------------------
|
| 196 |
+
# Disable bash history for all future shells
|
| 197 |
+
# -----------------------------
|
| 198 |
+
RUN echo '\
|
| 199 |
+
unset HISTFILE\n\
|
| 200 |
+
export HISTSIZE=0\n\
|
| 201 |
+
export HISTFILESIZE=0\n\
|
| 202 |
+
export HISTCONTROL=ignoreboth\n\
|
| 203 |
+
export PROMPT_COMMAND="history -r /dev/null"\n\
|
| 204 |
+
' >> /etc/profile && \
|
| 205 |
+
echo '\
|
| 206 |
+
unset HISTFILE\n\
|
| 207 |
+
export HISTSIZE=0\n\
|
| 208 |
+
export HISTFILESIZE=0\n\
|
| 209 |
+
export HISTCONTROL=ignoreboth\n\
|
| 210 |
+
export PROMPT_COMMAND="history -r /dev/null"\n\
|
| 211 |
+
' >> /etc/bash.bashrc && \
|
| 212 |
+
rm -f /root/.bash_history && \
|
| 213 |
+
mkdir -p /etc/skel && \
|
| 214 |
+
echo '\
|
| 215 |
+
unset HISTFILE\n\
|
| 216 |
+
export HISTSIZE=0\n\
|
| 217 |
+
export HISTFILESIZE=0\n\
|
| 218 |
+
export HISTCONTROL=ignoreboth\n\
|
| 219 |
+
export PROMPT_COMMAND="history -r /dev/null"\n\
|
| 220 |
+
' >> /etc/skel/.bashrc
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
# -----------------------------
|
| 224 |
+
# Create vscode user
|
| 225 |
+
# -----------------------------
|
| 226 |
+
RUN useradd -ms /bin/bash vscode \
|
| 227 |
+
&& echo "vscode:vscode" | chpasswd \
|
| 228 |
+
&& mkdir -p /home/vscode/.ssh \
|
| 229 |
+
&& chown -R vscode:vscode /home/vscode
|
| 230 |
+
|
| 231 |
+
USER vscode
|
| 232 |
+
ENV PATH=$PATH:/home/vscode/.local/bin
|
| 233 |
+
|
| 234 |
+
# -----------------------------
|
| 235 |
+
# Start the restoration step
|
| 236 |
+
# -----------------------------
|
| 237 |
+
RUN mkdir -p /home/vscode/backup
|
| 238 |
+
RUN hf download ThongCoding/vscode-data --local-dir /home/vscode --repo-type dataset
|
| 239 |
+
RUN cat /home/vscode/backup/workspace-backup.tar.gz.part-* > /home/vscode/backup/workspace-backup.tar.gz
|
| 240 |
+
RUN tar -xzf /home/vscode/backup/workspace-backup.tar.gz -C /home/vscode/workspace
|
| 241 |
+
RUN rm -rf /home/vscode/backup/*
|
| 242 |
+
|
| 243 |
+
# -----------------------------
|
| 244 |
+
# Entrypoint: restore + code-server
|
| 245 |
+
# -----------------------------
|
| 246 |
+
CMD /bin/bash -c "code-server --bind-addr 0.0.0.0:7860 --auth none /home/vscode/workspace"
|