File size: 9,346 Bytes
b6ed366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3d1e011
b6ed366
 
 
 
 
 
 
 
 
 
 
 
 
3d1e011
 
 
 
 
b6ed366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

# -----------------------------
# Core tools + Build Essentials
# -----------------------------
# Add apt-fast without interactive config
RUN apt-get update && apt-get install -y software-properties-common \
    && add-apt-repository -y ppa:apt-fast/stable \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive \
       apt-get -y install apt-fast \
    && echo "DOWNLOADBEFORE=true" | tee -a /etc/apt-fast.conf \
    && echo "MAXNUM=10" | tee -a /etc/apt-fast.conf \
    && echo "USE_PIGZ=1" | tee -a /etc/apt-fast.conf \
    && echo "APTFAST_PARA_OPTS=(--max-connection-per-server=12 --split=5)" | tee -a /etc/apt-fast.conf

    
RUN apt-fast update && apt-fast install -y \
    curl wget git git-lfs unzip sudo nano bash apt-fast \
    software-properties-common ca-certificates gnupg \
    build-essential g++ gfortran \
    cmake ninja-build pkg-config \
    llvm clang lld lldb \
    valgrind gdb strace ltrace \
    htop tree jq sqlite3 \
    net-tools iputils-ping \
    rsync git-extras pigz \
    fzf silversearcher-ag ripgrep mingw-w64 \
    && rm -rf /var/lib/apt/lists/*

RUN git lfs install


# Add Antigravity repository
RUN mkdir -p /etc/apt/keyrings && \
    curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | \
      gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg && \
    echo "deb [signed-by=/etc/apt/keyrings/antigravity-repo-key.gpg] https://us-central1-apt.pkg.dev/projects/antigravity-auto-updater-dev/ antigravity-debian main" | \
      tee /etc/apt/sources.list.d/antigravity.list > /dev/null


# Install Antigravity
RUN apt update && \
    apt install -y antigravity      
      
# -----------------------------
# Python 3.12
# -----------------------------
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-fast update
RUN apt-fast install -y python3.12 python3.12-venv python3.12-dev \
    && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 \
    && update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.12 1
RUN update-alternatives --set python3 /usr/bin/python3.12

# -----------------------------
# Rust (global)
# -----------------------------
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --no-modify-path \
    && mv /root/.cargo /usr/local/cargo \
    && mv /root/.rustup /usr/local/rustup \
    && ln -s /usr/local/cargo/bin/* /usr/local/bin/ \
    && rm -rf /root/.cargo /root/.rustup
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH

# -----------------------------
# Go (latest stable)
# -----------------------------
RUN curl -LO https://go.dev/dl/go1.23.0.linux-amd64.tar.gz \
    && tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz \
    && rm go1.23.0.linux-amd64.tar.gz
ENV PATH=/usr/local/go/bin:$PATH

# -----------------------------
# Node.js + Java + .NET
# -----------------------------
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-fast install -y nodejs
RUN apt-fast install -y openjdk-17-jdk
RUN wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && rm packages-microsoft-prod.deb \
    && apt-fast update && apt-fast install -y dotnet-sdk-8.0

# Yarn + Pnpm build tools
RUN npm install -g yarn pnpm

# -----------------------------
# Haskell
# -----------------------------
RUN apt-fast update && apt-fast install -y ghc cabal-install && rm -rf /var/lib/apt/lists/*

# -----------------------------
# Julia
# -----------------------------
RUN JULIA_VERSION=1.11.3 \
    && wget https://julialang-s3.julialang.org/bin/linux/x64/1.11/julia-$JULIA_VERSION-linux-x86_64.tar.gz \
    && tar -xzf julia-$JULIA_VERSION-linux-x86_64.tar.gz -C /opt/ \
    && ln -s /opt/julia-$JULIA_VERSION/bin/julia /usr/local/bin/julia \
    && rm julia-$JULIA_VERSION-linux-x86_64.tar.gz

# -----------------------------
# Scala + sbt
# -----------------------------
# Install dependencies
RUN apt-fast update && apt-fast install -y curl gnupg software-properties-common apt-transport-https && rm -rf /var/lib/apt/lists/*

# Add SBT repository and key
RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x99E82A75642AC823" | gpg --dearmor | tee /usr/share/keyrings/sbt.gpg > /dev/null \
    && 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 \
    && 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

# Install Scala + SBT
RUN apt-fast update && apt-fast install -y scala sbt && rm -rf /var/lib/apt/lists/*

# -----------------------------
# PHP + Composer
# -----------------------------
RUN apt-fast update && apt-fast install -y php-cli unzip \
    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && rm -rf /var/lib/apt/lists/*

# -----------------------------
# Ruby
# -----------------------------
RUN apt-fast update && apt-fast install -y ruby-full && rm -rf /var/lib/apt/lists/*

# -----------------------------
# code-server
# -----------------------------
RUN curl -fsSL https://code-server.dev/install.sh | sh

# -----------------------------
# Workspace + scripts
# -----------------------------
WORKDIR /home/vscode
RUN mkdir -p /home/vscode/workspace
COPY restore.py /restore.py
COPY app.py /app.py
COPY backup.py /home/backup.py
RUN chmod -R 777 /home

# -----------------------------
# Finishing touches -- you can comment these if not needed
# -----------------------------
# pip packages - dev/machine learning/AI
RUN pip install --upgrade pip setuptools wheel \
    && pip install black flake8 mypy jupyterlab ipython notebook

# more pip packages - for Hugging Face Hub
RUN pip install huggingface_hub huggingface_hub[cli] hf_xet hf_transfer
ENV HF_HUB_ENABLE_HF_TRANSFER=1

# even more pip packages - full-stack ML
RUN pip install numpy scipy pandas matplotlib seaborn scikit-learn \
    jupyter jupyterlab \
    torch torchvision torchaudio \
    tensorflow keras \
    datasets transformers accelerate

# Node tools
RUN npm install -g typescript ts-node nodemon

# Locales to prevent Unicode issues
RUN apt-fast update && apt-fast install -y locales \
    && locale-gen en_US.UTF-8 \
    && update-locale LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

# Database Clients
RUN apt-fast update && apt-fast install -y \
    mysql-client \
    postgresql-client \
    redis-tools \
    gnupg wget ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Install MongoDB Database Tools (mongo, mongodump, etc.)
RUN wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb.gpg \
    && echo "deb [signed-by=/usr/share/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" \
       | tee /etc/apt/sources.list.d/mongodb-org-7.0.list \
    && apt-fast update && apt-fast install -y mongodb-database-tools \
    && rm -rf /var/lib/apt/lists/*

# More build tools
RUN apt-fast update && apt-fast install -y \
    autoconf automake libtool m4 \
    ninja-build \
    nasm yasm \
    graphviz doxygen && rm -rf /var/lib/apt/lists/*

# Productivity + Debug
RUN apt-fast update && apt-fast install -y \
    tmux screen neovim \
    httpie \
    shellcheck \
    man-db manpages-dev && rm -rf /var/lib/apt/lists/*

# Removing cache
RUN apt-fast clean
RUN pip cache purge

# -----------------------------
# Disable bash history for all future shells
# -----------------------------
RUN echo '\
unset HISTFILE\n\
export HISTSIZE=0\n\
export HISTFILESIZE=0\n\
export HISTCONTROL=ignoreboth\n\
export PROMPT_COMMAND="history -r /dev/null"\n\
' >> /etc/profile && \
    echo '\
unset HISTFILE\n\
export HISTSIZE=0\n\
export HISTFILESIZE=0\n\
export HISTCONTROL=ignoreboth\n\
export PROMPT_COMMAND="history -r /dev/null"\n\
' >> /etc/bash.bashrc && \
    rm -f /root/.bash_history && \
    mkdir -p /etc/skel && \
    echo '\
unset HISTFILE\n\
export HISTSIZE=0\n\
export HISTFILESIZE=0\n\
export HISTCONTROL=ignoreboth\n\
export PROMPT_COMMAND="history -r /dev/null"\n\
' >> /etc/skel/.bashrc


# -----------------------------
# Create vscode user
# -----------------------------
RUN useradd -ms /bin/bash vscode \
    && echo "vscode:vscode" | chpasswd \
    && mkdir -p /home/vscode/.ssh \
    && chown -R vscode:vscode /home/vscode

USER vscode
ENV PATH=$PATH:/home/vscode/.local/bin

# -----------------------------
# Start the restoration step
# -----------------------------
RUN mkdir -p /home/vscode/backup
RUN hf download ThongCoder/vscode-public-data --local-dir /home/vscode --repo-type dataset
RUN cat /home/vscode/backup/workspace-backup.tar.gz.part-* > /home/vscode/backup/workspace-backup.tar.gz 
RUN tar -xzf /home/vscode/backup/workspace-backup.tar.gz -C /home/vscode/workspace
RUN rm -rf /home/vscode/backup/*

# -----------------------------
# Entrypoint: restore + code-server
# -----------------------------
VOLUME /home/vscode/workspace
ENTRYPOINT ["python3", "/app.py"]