#! /bin/sh
#
# Convenience for running a docker container as the current user, mounting their
# home directory and basic user environment variables
#
# Usage:
#   docker-as-user harbor.catalyst.net.nz/catalyst/node:22-noble npm install
#

set -e

exec docker run \
       -e USER=$USER -e USERNAME=$USERNAME -e HOME=$HOME \
       -v $HOME:$HOME --workdir $(pwd) --user $(id -u) --net host --rm "$@"
