nikhtu10 commited on
Commit
b6ed366
·
verified ·
1 Parent(s): cd26cf8

Create Dockerfile

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