#FROM node:25 #FROM node:alpine AS development FROM node:18 # Update apt cache RUN apt-get update RUN apt-get install -y # Set locale to en_US.UTF-8 ENV LANG=en_US.UTF-8 RUN apt-get install -y locales && \ sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ dpkg-reconfigure --frontend=noninteractive locales && \ update-locale LANG=$LANG # locale-gen en_US.UTF-8 # Install some apt packages RUN apt-get install -y sudo zsh git vim bat tmux jq lsof gawk # Cache busting argument to force re-builds of following steps (e.g. to get latest dotfiles) ARG CACHE_BUST=1 # For this to be effictive set `"runArgs": ["--build-arg", "CACHE_BUST=$(date +%s)"]` in devcontainer.json # Variable for default user `node` to be used in the following steps ARG USERNAME=node # Set zsh as default shell for `USERNAME` RUN chsh -s /bin/zsh $USERNAME # Ensure basic setup of default user `$USERNAME` # Not needed since node:18 already comes with a node user #RUN useradd -ms /bin/zsh $USERNAME \ # && chown -R node:node /home/$USERNAME # Ensure user `$USERNAME` has full access to `sudo` RUN mkdir -p /etc/sudoers.d \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME # From now on continue as user `$USERNAME` in user's home directory USER $USERNAME WORKDIR ~/ # Set zsh as default shell for node user and install zsh-in-docker (ohmyzsh, Powerlevel10k, etc.) # TODO review plugins, some may not even work without appropriate setup # TODO consider using dotfiles repo instead (requires: zplug install) #RUN echo "skip_global_compinit=1" | su - $USERNAME -c tee -a /home/$USERNAME/.zshenv # Install zplug #RUN curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh # Clone dotfiles to `/home/$USERNAME/dotfiles` and create all symlinks RUN git clone https://github.com/cbaoth/dotfiles ~/dotfiles; ~/dotfiles/link.sh; touch ~/.zplug-force-install # Start zsh one time with dotfiles to setup stuff (e.g. install zplug and plugins) RUN zsh -ic true #RUN ["zsh", "-ic", "source ~/.zplug/init.zsh; "] #RUN ["zsh", "-ic", "zplug install"] # COPY .zshenv .zshrc /home/$USERNAME/ # RUN chown $USERNAME:$USERNAME /home/$USERNAME/.zshenv /home/$USERNAME/.zshrc # RUN su - $USERNAME sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)" -- \ # -p git \ # -p git-extras \ # -p gitfast \ # -p ssh-agent \ ARG CACHE_BUST=0 # From now on continue as user `$USERNAME` in dev container working directory USER $USERNAME WORKDIR /workspace