feat: split images into 2 - base and workspace

This commit is contained in:
Pallav Vasa 2025-05-16 23:28:39 +00:00
parent 8812bb4528
commit 991478a0b0
2 changed files with 27 additions and 14 deletions

24
build-base.sh Executable file
View File

@ -0,0 +1,24 @@
#!/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 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."

View File

@ -1,22 +1,12 @@
#!/bin/bash
set -euo pipefail
BASE_IMG_NAME="analytics-backend-base"
IMG_NAME="analytics-backend-workspace"
DEV_USER=devuser
DEV_UID=1001
DEV_GID=1001
DEV_HOME=/home/$DEV_USER
ctr=$(buildah from archlinux)
buildah run "$ctr" -- bash -c "\
pacman -Sy --noconfirm && pacman -S --noconfirm --needed base-devel neovim git 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 secproc && groupadd -g $DEV_GID $DEV_USER && \
useradd -ms /bin/fish -G secproc -u $DEV_UID -g $DEV_GID $DEV_USER
"
ctr=$(buildah from "$BASE_IMG_NAME")
buildah add "$ctr" home.tar.gz $DEV_HOME
@ -38,5 +28,4 @@ buildah config \
"$ctr"
buildah commit "$ctr" $IMG_NAME
echo "$IMG_NAME built."
echo "$IMG_NAME built from $BASE_IMG_NAME."