From fd0c07e95450efb3939a798302d42f96eb578503 Mon Sep 17 00:00:00 2001 From: Pallav Vasa Date: Sat, 17 May 2025 13:21:36 +0000 Subject: [PATCH] feat: remove buildah scripts and adapt project to use Containerfile --- access.yml | 4 ++-- build-base.sh | 24 ------------------------ build-workspace.sh | 32 -------------------------------- gitops_router.sh | 8 ++++---- 4 files changed, 6 insertions(+), 62 deletions(-) delete mode 100755 build-base.sh delete mode 100755 build-workspace.sh diff --git a/access.yml b/access.yml index e44b598..4230837 100644 --- a/access.yml +++ b/access.yml @@ -5,14 +5,14 @@ pallav: build: - base - workspace + - all update: - - base - - workspace - access - ssh_router - gitops_router - home_tar - gitconfig + - containerfile clean: status: remove: diff --git a/build-base.sh b/build-base.sh deleted file mode 100755 index 33300eb..0000000 --- a/build-base.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -euo pipefail - -BASE_IMG_NAME="analytics-backend-base" -DEV_USER=devuser -DEV_UID=1001 -DEV_GID=1001 - -ctr=$(buildah from archlinux) - -buildah run "$ctr" -- bash -c " - pacman -Sy --noconfirm && \ - pacman -S --noconfirm --needed base-devel neovim git git-lfs fish tmux \ - nodejs python podman fzf fd ripgrep jdk-openjdk fisher yazi less buildah \ - lazygit luarocks python-pynvim npm bash-completion tree-sitter-cli kitty-terminfo \ - lua51 openssh && \ - pacman -Scc --noconfirm && \ - groupadd -g $DEV_GID $DEV_USER && \ - groupadd -g 1002 secproc && \ - useradd -ms /bin/fish -G secproc -u $DEV_UID -g $DEV_GID $DEV_USER -" - -buildah commit "$ctr" $BASE_IMG_NAME -echo "✅ $BASE_IMG_NAME built." diff --git a/build-workspace.sh b/build-workspace.sh deleted file mode 100755 index 09a6306..0000000 --- a/build-workspace.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -euo pipefail - -BASE_IMG_NAME="analytics-backend-base" -IMG_NAME="analytics-backend-workspace" -DEV_USER=devuser -DEV_HOME=/home/$DEV_USER - -ctr=$(buildah from "$BASE_IMG_NAME") - -buildah add "$ctr" home.tar.gz $DEV_HOME - -# shellcheck disable=SC2016 -buildah run "$ctr" -- fish -c ' - set -gx HOME '"$DEV_HOME"'; - ssh-keyscan -p 2222 10.88.0.1 >> $HOME/.ssh/known_hosts; - ssh-keyscan -p 22 github.com >> $HOME/.ssh/known_hosts; - chown -R '"$DEV_USER"':'"$DEV_USER"' $HOME/.local $HOME/.config/fish/completions \ - $HOME/.config/fish/functions $HOME/.config/fish/fish_variables $HOME/.ssh; - chown '"$DEV_USER"':'"$DEV_USER"' $HOME/.config $HOME/.config/fish \ - $HOME/.config/tmux; -' - -buildah config \ - --user $DEV_USER \ - --workingdir /app \ - --env CONTAINER_HOST=unix:///run/podman/podman.sock \ - --cmd "[\"$DEV_HOME/start.sh\"]" \ - "$ctr" - -buildah commit "$ctr" $IMG_NAME -echo "✅ $IMG_NAME built from $BASE_IMG_NAME." diff --git a/gitops_router.sh b/gitops_router.sh index 84fb280..7296134 100644 --- a/gitops_router.sh +++ b/gitops_router.sh @@ -210,15 +210,15 @@ validate_command "$cmd" "${args[@]}" case "$cmd" in build) case "${args[0]}" in - base) run build-base.sh ;; - workspace) run build-workspace.sh ;; + base) podman build --target base -t analytics-backend-base . ;; + workspace) podman build --target base -t analytics-backend-base . ;; + all) podman build -t analytics-backend-workspace . ;; *) log ERROR "build: invalid arg '${args[0]}'" ;; esac ;; update) case "${args[0]}" in - base) update build-base.sh .local/bin 500 ;; - workspace) update build-workspace.sh .local/bin 500 ;; + containerfile) update Containerfile . 500 ;; access) update access.yml . 400 ;; ssh_router) update ssh_router.sh .local/bin 500 ;; gitops_router) update gitops_router.sh .local/bin 500 ;;