codematic / Dockerfile
ThongCoder's picture
Update Dockerfile
a68492d verified
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# -----------------------------
# Core tools + Build Essentials
# -----------------------------
RUN apt-get update && apt-get install -y \
curl wget git git-lfs unzip sudo nano bash \
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 \
fzf silversearcher-ag ripgrep \
&& rm -rf /var/lib/apt/lists/*
RUN git lfs install
# -----------------------------
# Python 3.12
# -----------------------------
RUN add-apt-repository ppa:deadsnakes/ppa -y && apt-get update
RUN apt-get 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-get install -y nodejs
RUN apt-get 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-get update && apt-get install -y dotnet-sdk-8.0
# Yarn + Pnpm build tools
RUN npm install -g yarn pnpm
# -----------------------------
# 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
# Node tools
RUN npm install -g typescript ts-node nodemon
# Locales to prevent Unicode issues
RUN apt-get update && apt-get 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
# -----------------------------
# Check versions of installed tools
# -----------------------------
RUN echo "===== Installed versions =====" && \
python3 --version && pip --version && \
rustc --version && cargo --version && \
go version && \
node -v && npm -v && yarn -v && pnpm -v && \
java -version && javac -version && \
dotnet --version && \
cmake --version && ninja --version && \
gcc --version && g++ --version && \
clang --version && lldb --version && \
git --version && git lfs version && \
jq --version && htop --version && \
fzf --version && rg --version && ag --version
# -----------------------------
# 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
# -----------------------------
# Entrypoint: restore + code-server
# -----------------------------
CMD /bin/bash -c "\
python3 /restore.py && \
code-server --bind-addr 0.0.0.0:7860 --auth none /home/vscode/workspace"