72 lines
2.4 KiB
Docker
72 lines
2.4 KiB
Docker
FROM ubuntu:25.04
|
|
|
|
# --- Setup for NVM and other tools ---
|
|
|
|
# Update package lists and install basic dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
git \
|
|
nodejs \
|
|
npm \
|
|
build-essential \
|
|
zsh \
|
|
tmux \
|
|
wget \
|
|
unzip \
|
|
neovim \
|
|
starship \
|
|
iputils-ping \
|
|
sudo \
|
|
procps \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install NVM
|
|
# Using a specific NVM version is good practice. Check the latest stable version.
|
|
ENV NVM_DIR="/usr/local/nvm"
|
|
RUN mkdir -p ${NVM_DIR} && \
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \
|
|
# Ensure NVM paths are added to shell profiles for all users
|
|
echo 'export NVM_DIR="/usr/local/nvm"' >> /etc/profile.d/nvm.sh && \
|
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> /etc/profile.d/nvm.sh && \
|
|
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> /etc/profile.d/nvm.sh && \
|
|
chmod +x /etc/profile.d/nvm.sh
|
|
|
|
# Install some default Node.js version and global packages with NVM
|
|
# This will be available to all users.
|
|
# You might want to install `npm` itself, or specific global packages.
|
|
# Ensure NVM is sourced before using it.
|
|
RUN bashenv="$(mktemp)" && \
|
|
echo '#!/bin/bash' > "$bashenv" && \
|
|
echo '. /etc/profile.d/nvm.sh' >> "$bashenv" && \
|
|
echo 'nvm install 23' >> "$bashenv" && \
|
|
echo 'nvm use 23' >> "$bashenv" && \
|
|
echo 'corepack enable' >> "$bashenv" && \
|
|
chmod +x "$bashenv" && \
|
|
"$bashenv" && \
|
|
rm "$bashenv"
|
|
|
|
RUN bashenv_nvim_init="$(mktemp)" && \
|
|
echo '#!/bin/bash' > "$bashenv_nvim_init" && \
|
|
echo '. /etc/profile.d/nvm.sh' >> "$basenenv_nvim_init" && \
|
|
echo 'npm install -g neovim' >> "$basenenv_nvim_init" && \
|
|
echo 'nvim --headless "+Lazy! sync" +qa || true' >> "$basenenv_nvim_init" && \
|
|
echo 'nvim --headless "+MasonToolsUpdate" +qa || true' >> "$basenenv_nvim_init" && \
|
|
chmod +x "$basenenv_nvim_init" && \
|
|
"$basenenv_nvim_init" && \
|
|
rm "$basenenv_nvim_init"
|
|
|
|
|
|
RUN groupadd --gid 11005 coder \
|
|
&& useradd -s /bin/bash --uid 11005 --gid 11005 -m coder \
|
|
&& apt-get update && apt-get install -y sudo \
|
|
&& echo coder ALL=\(ALL\) NOPASSWD:ALL > /etc/sudoers.d/coder \
|
|
&& chmod 0440 /etc/sudoers.d/coder \
|
|
&& chsh -s /usr/bin/zsh coder
|
|
|
|
RUN mkdir -p /home/coder/.config && chown -R coder:coder /home/coder
|
|
USER coder
|
|
RUN git clone https://gitea.olsen.cloud/morten/nvim.git /home/coder/.config/nvim
|
|
|
|
COPY --chown=coder:coder ./env/ /home/coder/
|
|
|