The problem was that we mounted `pwd` as HOME and that meant that every time git was used it would look into the data and work for a long time, and it would also commit everything there. Now we have a central container-home directory in the directory where we checked out this git repo and it is used by each session independent of in which project directory we are.
17 lines
483 B
Text
17 lines
483 B
Text
OPENCODE_CONTAINER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
|
|
opencode() {
|
|
local uid=$(id -u)
|
|
local gid=$(id -g)
|
|
local user=$(whoami)
|
|
UID="$uid" \
|
|
GID="$gid" \
|
|
USER="$user" \
|
|
CONTAINER_HOME="$OPENCODE_CONTAINER_DIR/container-home" \
|
|
docker compose \
|
|
-f "$OPENCODE_CONTAINER_DIR/docker-compose.yaml" \
|
|
run --rm \
|
|
-u "$uid:$gid" \
|
|
opencode opencode "$@" \
|
|
2> >(grep -v "No services to build" >&2)
|
|
}
|