feat: remove buildah scripts and adapt project to use Containerfile
This commit is contained in:
parent
d3f5e93ad8
commit
fd0c07e954
@ -5,14 +5,14 @@ pallav:
|
|||||||
build:
|
build:
|
||||||
- base
|
- base
|
||||||
- workspace
|
- workspace
|
||||||
|
- all
|
||||||
update:
|
update:
|
||||||
- base
|
|
||||||
- workspace
|
|
||||||
- access
|
- access
|
||||||
- ssh_router
|
- ssh_router
|
||||||
- gitops_router
|
- gitops_router
|
||||||
- home_tar
|
- home_tar
|
||||||
- gitconfig
|
- gitconfig
|
||||||
|
- containerfile
|
||||||
clean:
|
clean:
|
||||||
status:
|
status:
|
||||||
remove:
|
remove:
|
||||||
|
@ -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."
|
|
@ -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."
|
|
@ -210,15 +210,15 @@ validate_command "$cmd" "${args[@]}"
|
|||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
build)
|
build)
|
||||||
case "${args[0]}" in
|
case "${args[0]}" in
|
||||||
base) run build-base.sh ;;
|
base) podman build --target base -t analytics-backend-base . ;;
|
||||||
workspace) run build-workspace.sh ;;
|
workspace) podman build --target base -t analytics-backend-base . ;;
|
||||||
|
all) podman build -t analytics-backend-workspace . ;;
|
||||||
*) log ERROR "build: invalid arg '${args[0]}'" ;;
|
*) log ERROR "build: invalid arg '${args[0]}'" ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
case "${args[0]}" in
|
case "${args[0]}" in
|
||||||
base) update build-base.sh .local/bin 500 ;;
|
containerfile) update Containerfile . 500 ;;
|
||||||
workspace) update build-workspace.sh .local/bin 500 ;;
|
|
||||||
access) update access.yml . 400 ;;
|
access) update access.yml . 400 ;;
|
||||||
ssh_router) update ssh_router.sh .local/bin 500 ;;
|
ssh_router) update ssh_router.sh .local/bin 500 ;;
|
||||||
gitops_router) update gitops_router.sh .local/bin 500 ;;
|
gitops_router) update gitops_router.sh .local/bin 500 ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user