~mapperr/dockerfiles

aa2da0af4f0f9eba976a8b93e6a7c6c8a47effcc — mapperr 9 months ago 10733ae
add envsubst expansion
2 files changed, 10 insertions(+), 3 deletions(-)

M archlinux/run.sh
M archlinux/work_provision.sh
M archlinux/run.sh => archlinux/run.sh +6 -2
@@ 61,16 61,20 @@ elif test "$cmd" = "setup"; then
    echo "changing permissions"
    docker exec $cont_name sudo chown -R ${my_user}:${my_user} /home/${my_user}

    export DOCKER_GROUP_HOST=$(grep docker /etc/group | cut -d':' -f3)

    if test -r provision.sh; then
        echo "copying and executing common provision script"
        docker cp provision.sh $cont_name:/home/${my_user}/
        cat provision.sh | envsubst '$DOCKER_GROUP_HOST' > /tmp/provision.sh
        docker cp /tmp/provision.sh $cont_name:/home/${my_user}/
        docker exec $cont_name sudo chown -R ${my_user}:${my_user} /home/${my_user}
        docker exec -it --user 1000 $cont_name sh /home/${my_user}/provision.sh
    fi
    provision_file="${context}_provision.sh"
    if test -r $provision_file; then
        echo "copying and executing ${context} provision script"
        docker cp $provision_file $cont_name:/home/${my_user}/
        cat $provision_file | envsubst '$DOCKER_GROUP_HOST' > /tmp/$provision_file
        docker cp /tmp/$provision_file $cont_name:/home/${my_user}/
        docker exec $cont_name sudo chown -R ${my_user}:${my_user} /home/${my_user}
        docker exec -it --user 1000 $cont_name sh /home/${my_user}/$provision_file
    fi

M archlinux/work_provision.sh => archlinux/work_provision.sh +4 -1
@@ 1,6 1,9 @@
#! /bin/sh

# vars expanded with envsubst on host:
# DOCKER_GROUP_HOST

minpac_dir=$HOME/.config/nvim/pack/minpac/opt/minpac  && \
test -d $minpac_dir || git clone https://github.com/k-takata/minpac.git $minpac_dir  && \

sudo usermod -aG docker $(whoami)
sudo groupadd -g $DOCKER_GROUP_HOST -U $(whoami) dockerhost