Skip to content

Commit

Permalink
Merge pull request #2 from psadi/feature/workflow
Browse files Browse the repository at this point in the history
feat: added github workflow for pde
  • Loading branch information
psadi authored Jan 29, 2024
2 parents 8b3317a + 7a93e58 commit 7719a22
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Build & Publish Docker image

on:
workflow_dispatch: {}
push:
branches: ["main", "feature/workflow "]
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: psadi/pde

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
101 changes: 101 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
FROM debian:bookworm-slim

COPY . /tmp/dotfiles

# --------------------------
# SETUP
# --------------------------
RUN apt-get update && apt-get upgrade && apt-get install -y \
build-essential git curl wget axel sudo zsh jq zip unzip \
python3 python3-pip python3-setuptools python3-wheel && \
# --------------------------
# CREATE & CONFIGURE USER
# --------------------------
useradd -m -s /usr/bin/zsh -G sudo -u 1000 -U psadi && \
echo "psadi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
usermod --password 3494 psadi && \
chsh -s /usr/bin/zsh psadi && \
# --------------------------
# NEOVIM
# --------------------------
mkdir -p /opt/pkg && chown psadi:psadi /opt/pkg && \
axel --quiet https://github.com/neovim/neovim/releases/download/$(curl -L -s "https://api.github.com/repos/neovim/neovim/tags" | jq -r '.[0].name')/nvim-linux64.tar.gz --output=/opt/pkg && \
tar -xzf /opt/pkg/nvim-linux64.tar.gz -C /opt/pkg && \
touch /home/psadi/.hushlogin && \
# --------------------------
# ZELLIJ
# --------------------------
axel --quiet https://github.com/zellij-org/zellij/releases/download/$(curl -L -s "https://api.github.com/repos/zellij-org/zellij/tags" | jq -r '.[0].name')/zellij-x86_64-unknown-linux-musl.tar.gz --output=/opt/pkg && \
tar -xzf /opt/pkg/zellij-x86_64-unknown-linux-musl.tar.gz -C /opt/pkg && \
mv /opt/pkg/zellij /usr/local/bin/zellij && \
chmod +x /usr/local/bin/zellij && \
rm /opt/pkg/zellij-x86_64-unknown-linux-musl.tar.gz && \
# --------------------------
# EZA
# --------------------------
axel --quiet https://github.com/eza-community/eza/releases/download/$(curl -L -s "https://api.github.com/repos/eza-community/eza/tags" | jq -r '.[0].name')/eza_x86_64-unknown-linux-gnu.tar.gz --output=/opt/pkg && \
tar -xzf /opt/pkg/eza_x86_64-unknown-linux-gnu.tar.gz -C /opt/pkg && \
mv /opt/pkg/eza /usr/local/bin/eza && \
chmod +x /usr/local/bin/eza && \
rm /opt/pkg/eza_x86_64-unknown-linux-gnu.tar.gz && \
# --------------------------
# FZF
# --------------------------
axel --quiet https://github.com/junegunn/fzf/releases/download/$(curl -L -s "https://api.github.com/repos/junegunn/fzf/tags" | jq -r '.[0].name')/fzf-0.46.0-linux_amd64.tar.gz --output=/opt/pkg && \
tar -xzf /opt/pkg/fzf-0.46.0-linux_amd64.tar.gz -C /opt/pkg && \
mv /opt/pkg/fzf /usr/local/bin/fzf && \
chmod +x /usr/local/bin/fzf && \
rm /opt/pkg/fzf-0.46.0-linux_amd64.tar.gz && \
# --------------------------
# KUBECTL
# --------------------------
axel --quiet https://dl.k8s.io/release/$(curl -L -s "https://dl.k8s.io/release/stable.txt")/bin/linux/amd64/kubectl --output=/usr/local/bin && \
chmod +x /usr/local/bin/kubectl && \
# --------------------------
# HELM
# --------------------------
curl -s https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash && \
# --------------------------
# K9S
# --------------------------
axel --quiet https://github.com/derailed/k9s/releases/download/$(curl -L -s "https://api.github.com/repos/derailed/k9s/tags" | jq -r '.[0].name')/k9s_Linux_amd64.tar.gz --output=/opt/pkg && \
tar -C /opt/pkg -zxf /opt/pkg/k9s_Linux_amd64.tar.gz k9s && \
mv /opt/pkg/k9s /usr/local/bin/k9s && \
chmod +x /usr/local/bin/k9s && \
rm /opt/pkg/k9s_Linux_amd64.tar.gz && \
# --------------------------
# TERRAFORM
# --------------------------
tf_latest=$(curl -L -s "https://api.github.com/repos/hashicorp/terraform/tags" | jq -r '.[0].name' | sed -e 's/v//g') && \
axel --quiet "https://releases.hashicorp.com/terraform/${tf_latest}/terraform_${tf_latest}_linux_amd64.zip" --output=/opt/pkg && \
unzip -q "/opt/pkg/terraform_${tf_latest}_linux_amd64.zip" -d /usr/local/bin && \
chmod +x /usr/local/bin/terraform && \
rm "/opt/pkg/terraform_${tf_latest}_linux_amd64.zip" && \
# --------------------------
# FINALIZE & CLEANUP
# --------------------------
apt-get clean && \
apt-get autoclean && \
apt-get autoremove --purge && \
python3 -m pip cache purge && \
rm -rf /var/log/* && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/* && \
rm -rf /opt/pkg/nvim-linux64.tar.gz && \
rm /home/psadi/.profile && rm /home/psadi/.bash* && \
chown -R root:root /usr/local/bin && \
mv /tmp/dotfiles /home/psadi/dotfiles && \
mkdir -p /home/psadi/.config && \
ln -s /home/psadi/dotfiles/zsh/zshrc /home/psadi/.zshrc && \
ln -s /home/psadi/dotfiles/git/.gitconfig /home/psadi/.gitconfig && \
ln -s /home/psadi/dotfiles/zellij /home/psadi/.config/zellij && \
chown -R psadi:psadi /home/psadi

WORKDIR /home/psadi

USER psadi

RUN git clone https://github.com/LazyVim/starter ~/.config/nvim && \
/opt/pkg/nvim-linux64/bin/nvim -c "qa"

ENTRYPOINT ["/usr/bin/zsh"]
8 changes: 4 additions & 4 deletions zsh/zsh/cmd/command.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ if command -v bat &> /dev/null; then
export MANPAGER="bat"
fi

if [ -d /opt/nvim-linux64 ]; then
export PATH=$PATH:/opt/nvim-linux64/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nvim-linux64/lib
export MANPATH=$MANPATH:/opt/nvim-linux64/man
if [ -d /opt/pkg/nvim-linux64 ]; then
export PATH=$PATH:/opt/pkg/nvim-linux64/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/pkg/nvim-linux64/lib
export MANPATH=$MANPATH:/opt/pkg/nvim-linux64/man
fi
2 changes: 1 addition & 1 deletion zsh/zsh/completions/completions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ to_fpath(){
fpath=($_ZSH_COMPLETIONS_PATH/$1 $fpath)
}

for z in `find ${_ZSH_COMPLETIONS_PATH} -type d -depth 1 -exec basename {} \;`;
for z in `find ${_ZSH_COMPLETIONS_PATH} -mindepth 1 -type d -exec basename {} \;`;
do
source "${_ZSH_COMPLETIONS_PATH}/${z}/${z}.zsh";
done;
2 changes: 1 addition & 1 deletion zsh/zsh/plugins/zsh-z/zsh-z.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ elif type complete >/dev/null 2>&1; then
PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''(_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null &);'
}
}
fi
fi

0 comments on commit 7719a22

Please sign in to comment.