#!/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."