|
| 1 | +FROM mcr.microsoft.com/devcontainers/base:alpine-3.19 |
| 2 | +ENV PYTHONUNBUFFERED 1 |
| 3 | +ARG USERNAME=vscode |
| 4 | + |
| 5 | +RUN apk add --no-cache \ |
| 6 | + zsh \ |
| 7 | + ca-certificates curl wget gettext sshpass \ |
| 8 | + fzf jq git openssh-client \ |
| 9 | + go-task \ |
| 10 | + python3 py3-pip py3-virtualenv\ |
| 11 | + git direnv shellcheck\ |
| 12 | + ansible ansible-lint &&\ |
| 13 | + apk add --no-cache \ |
| 14 | + --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \ |
| 15 | + age helm kubectl sops &&\ |
| 16 | + apk add --no-cache \ |
| 17 | + --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \ |
| 18 | + lsd |
| 19 | +RUN if [ -f /etc/bash.bashrc ]; then \ |
| 20 | + echo -e 'eval "$(direnv hook bash)"' >> /etc/bash.bashrc; \ |
| 21 | + fi && \ |
| 22 | + if [ -f /etc/zsh/zshrc ]; then \ |
| 23 | + echo -e 'eval "$(direnv hook zsh)"' >> /etc/zsh/zshrc; \ |
| 24 | + fi |
| 25 | +USER $USERNAME |
| 26 | + |
| 27 | +# Add direnv whitelist for the workspace directory |
| 28 | +RUN mkdir -p /home/$USERNAME/.config/direnv &&\ |
| 29 | + chown -R $USERNAME:$USERNAME /home/$USERNAME/.config &&\ |
| 30 | +tee /home/$USERNAME/.config/direnv/direnv.toml > /dev/null <<EOF |
| 31 | +[whitelist] |
| 32 | +prefix = [ "/workspaces", "/home/vscode/.dotfiles" ] |
| 33 | +EOF |
| 34 | + |
| 35 | +WORKDIR /workspaces |
| 36 | +RUN virtualenv /home/$USERNAME/.venv &&\ |
| 37 | + git config --global --add safe.directory /workspaces/dotfiles &&\ |
| 38 | + git config --global --add safe.directory /home/$USERNAME/.dotfiles |
| 39 | +ENV VIRTUAL_ENV /home/$USERNAME/.venv |
| 40 | +ENV PATH $VIRTUAL_ENV:$PATH |
| 41 | +RUN . $VIRTUAL_ENV/bin/activate && pip install --upgrade pip && pip install pre-commit |
| 42 | +RUN mkdir /home/$USERNAME/.fonts \ |
| 43 | +# Download MesloLGS font files |
| 44 | +&& curl -sLo /home/$USERNAME/.fonts/MesloLGS\ NF\ Regular.ttf https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf \ |
| 45 | +&& curl -sLo /home/$USERNAME/.fonts/MesloLGS\ NF\ Bold.ttf https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf \ |
| 46 | +&& curl -sLo /home/$USERNAME/.fonts/MesloLGS\ NF\ Italic.ttf https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf \ |
| 47 | +&& curl -sLo /home/$USERNAME/.fonts/MesloLGS\ NF\ Bold\ Italic.ttf https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf \ |
| 48 | +# Download zsh-syntax-highlighting |
| 49 | +&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /home/$USERNAME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting --depth 1 \ |
| 50 | +# Download zsh-autosuggestions |
| 51 | +&& git clone https://github.com/zsh-users/zsh-autosuggestions /home/$USERNAME/.oh-my-zsh/custom/plugins/zsh-autosuggestions --depth 1 \ |
| 52 | +# Download powerlevel10k |
| 53 | +&& git clone https://github.com/romkatv/powerlevel10k.git /home/$USERNAME/.oh-my-zsh/custom/themes/powerlevel10k --depth=1 \ |
| 54 | +# Download powerlevel10k config |
| 55 | +&& curl -sLo /home/$USERNAME/.p10k.zsh https://raw.githubusercontent.com/usma0118/dotfiles/HEAD/zshrc/themes/dev.p10k.zsh \ |
| 56 | +&& curl -sLo /home/$USERNAME/.zsh https://raw.githubusercontent.com/usma0118/dotfiles/HEAD/.profile/.zshrc \ |
| 57 | +&& curl -sLo /home/$USERNAME/.aliases https://raw.githubusercontent.com/usma0118/dotfiles/HEAD/.profile/.aliases |
| 58 | + |
| 59 | +RUN mkdir -p /home/$USERNAME/.vscode-server/extensions \ |
| 60 | + /home/$USERNAME/.cache \ |
| 61 | + /home/$USERNAME/.local \ |
| 62 | + /home/$USERNAME/.history \ |
| 63 | + && chown -R $USERNAME \ |
| 64 | + /home/$USERNAME/.vscode-server \ |
| 65 | + /home/$USERNAME/.cache \ |
| 66 | + /home/$USERNAME/.local \ |
| 67 | + /home/$USERNAME/.history \ |
| 68 | + /home/$USERNAME/.oh-my-zsh/custom/themes \ |
| 69 | + /home/$USERNAME/.oh-my-zsh/custom/plugins &&\ |
| 70 | + SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/home/$USERNAME/.history/.bash_history" >> "/home/$USERNAME/.bashrc" &&\ |
| 71 | + echo "export PROMPT_COMMAND='history -a' && export HISTFILE=/home/$USERNAME/.history/.zsh_history" >> "/home/$USERNAME/.zsh_history" |
| 72 | + |
| 73 | +RUN echo "Pre-Loading zsh" && zsh -i -c "exit" |
0 commit comments