Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
FROM mcr.microsoft.com/devcontainers/base:jammy
# FROM mcr.microsoft.com/devcontainers/base:jammy

ARG DEBIAN_FRONTEND=noninteractive
ARG USER=vscode

RUN DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y build-essential --no-install-recommends \
bat \
bison \
bsdmainutils \
build-essential \
ca-certificates \
cmake \
curl \
file \
gcc \
git \
iputils-ping \
jq \
libbz2-dev \
libedit-dev \
libffi-dev \
liblzma-dev \
libncurses-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
llvm \
make \
nala \
net-tools \
pipx \
procps \
software-properties-common \
telnet \
tk-dev \
tzdata \
unzip \
vim \
wget \
xz-utils \
zlib1g-dev

# Install yq
ENV YQ_VERSION="v4.47.1"
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 \
&& chmod +x /usr/local/bin/yq

# Run setup eza script
COPY scripts/setup-eza.sh /tmp/setup-eza.sh
RUN chmod +x /tmp/setup-eza.sh && /tmp/setup-eza.sh

# Run setup fnm script
COPY scripts/setup-fnm.sh /tmp/setup-fnm.sh
RUN chmod +x /tmp/setup-fnm.sh && /tmp/setup-fnm.sh

# Python and poetry installation
USER $USER
ARG HOME="/home/$USER"
ARG PYTHON_VERSION=3.9
# ARG PYTHON_VERSION=3.10

ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${HOME}/.local/bin:$PATH"

COPY ./dotfiles/ /tmp/setup/

RUN <<"EOT" bash
set -eux

# Create Symbolic Links
sudo mkdir -p /opt/certs /opt/Documents /opt/Downloads /opt/.ssh
sudo ln -sf /opt/Documents ~/Documents
sudo ln -sf /opt/Downloads ~/Downloads
EOT

RUN <<"EOT" bash
set -eux

### Setup shell
sudo cp -r /tmp/setup/. ~/
sudo chown -R ${USER}:${USER} ~/.
EOT

RUN echo "done 0" \
&& curl https://pyenv.run | bash \
&& echo "done 1" \
&& pyenv install ${PYTHON_VERSION} \
&& echo "done 2" \
&& pyenv global ${PYTHON_VERSION} \
&& echo "done 3" \
&& curl -sSL https://install.python-poetry.org | python3 - \
&& poetry config virtualenvs.in-project true
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "poetry3-poetry-pyenv",
"build": {
"dockerfile": "Dockerfile"
},
// 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
// "features": {},
// 👇 Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// 👇 Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "bash .devcontainer/scripts/setup-dependencies.sh",
// 👇 Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"njpwerner.autodocstring",
"seatonjiang.gitmoji-vscode",
"redhat.vscode-yaml",
"GitHub.vscode-github-actions",
"GitHub.vscode-pull-request-github",
"GitHub.copilot-chat",
"GitHub.copilot"
]
}
},
"features": {
"ghcr.io/devcontainers-community/npm-features/prettier:1": {
"version": "latest"
},
"ghcr.io/schlich/devcontainer-features/powerlevel10k:1": {},
"ghcr.io/nils-geistmann/devcontainers-features/zsh:0": {
"setLocale": true,
"theme": "agnoster",
"plugins": "git docker sudo python poetry eza aliases",
"desiredLocale": "en_US.UTF-8 UTF-8"
},
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
"plugins": "ssh-agent npm",
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions",
"username": "vscode"
},
"ghcr.io/braun-daniel/devcontainer-features/fzf:1": {}
}
// 👇 Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 2 additions & 0 deletions .devcontainer/dotfiles/.aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alias zrld="source ~/.zshrc"
alias zcfg="$EDITOR ~/.zshrc && zrld"
60 changes: 60 additions & 0 deletions .devcontainer/dotfiles/.zplugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# shellcheck disable=SC2148
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"

# source ~/.zplugins
# Load starship theme
# line 1: `starship` binary as command, from github release
# line 2: starship setup at clone(create init.zsh, completion)
# line 3: pull behavior same as clone, source init.zsh
zinit ice as"command" from"gh-r" \
atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \
atpull"%atclone" src"init.zsh"
zinit light starship/starship

# Binary release in archive, from GitHub-releases page.
# After automatic unpacking it provides program "fzf".
zi ice from"gh-r" as"program"
zi light junegunn/fzf

# Vim repository on GitHub – a typical source code that needs compilation – Zinit
# can manage it for you if you like, run `./configure` and other `make`, etc.
# Ice-mod `pick` selects a binary program to add to $PATH. You could also install the
# package under the path $ZPFX, see: https://zdharma-continuum.github.io/zinit/wiki/Compiling-programs
# zi ice \
# as"program" \
# atclone"rm -f src/auto/config.cache; ./configure" \
# atpull"%atclone" \
# make \
# pick"src/vim"
# zi light vim/vim

zi light Aloxaf/fzf-tab
zi light lincheney/fzf-tab-completion
zi light ahmetb/kubectl-aliases
zi light Freed-Wu/fzf-tab-source

zi snippet OMZP::git
zi snippet OMZP::sudo
zi snippet OMZP::poetry
zi snippet OMZP::eza
zi snippet OMZP::dotenv
zi snippet OMZP::colorize
zi snippet OMZP::aliases


### fzf-tab

export LESSOPEN='|~/.lesspipe.sh %s'

zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# shellcheck disable=SC2086
# shellcheck disable=SC2296
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
zstyle ':fzf-tab:*' fzf-bindings 'ctrl-j:accept' 'ctrl-a:toggle-all'

zstyle ':fzf-tab:complete:*:*' fzf-flags --preview-window=right,60% --height=70% --border=double
zstyle ':completion:*:descriptions' format '[%d]'
39 changes: 39 additions & 0 deletions .devcontainer/dotfiles/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
source ~/.zplugins

export EDITOR='vim'
export KUBE_EDITOR='code -w'
source ~/.aliases
bindkey -e
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word

### Brew

export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew";
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar";
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew";
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}";
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}";

### Starship

eval "$(starship init zsh)"

### fnm

FNM_PATH="/home/vscode/.local/share/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="$FNM_PATH:$PATH"
eval "`fnm env`"
fi

### Pipx

export PATH="$PATH:/home/user/.local/bin"

### Pyenv

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
10 changes: 10 additions & 0 deletions .devcontainer/scripts/setup-eza.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

sudo apt update
sudo apt install -y gpg
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza
3 changes: 3 additions & 0 deletions .devcontainer/scripts/setup-fnm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

curl -fsSL https://fnm.vercel.app/install | bash
Loading
Loading