diff --git a/os/debian/Dockerfile.debian b/os/debian/Dockerfile.debian index 8a46f0e45..0f6d2937c 100644 --- a/os/debian/Dockerfile.debian +++ b/os/debian/Dockerfile.debian @@ -107,7 +107,7 @@ COPY packages.txt os/debian/packages-debian.txt /etc/apt/ ## Here is where we would copy in the repo checksum in an attempt to ensure updates bust the Docker build cache # Add CloudPosse package repo -RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl +RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl bindfs RUN curl -1sLf 'https://dl.cloudsmith.io/public/cloudposse/packages/cfg/setup/bash.deb.sh' | bash # Install Google package repo diff --git a/rootfs/etc/profile.d/_localhost.sh b/rootfs/etc/profile.d/_localhost.sh new file mode 100644 index 000000000..03293c068 --- /dev/null +++ b/rootfs/etc/profile.d/_localhost.sh @@ -0,0 +1,10 @@ +if [[ -n $GEODESIC_HOST_UID ]] && [[ -n $GEODESIC_HOST_GID ]] && df -a | grep -q /localhost.bindfs; then + # Things are really wonky if this fails -- i think 'set -e' is good here + set -e + if [ -d /localhost ]; then + mv /localhost /localhost.from-docker + mkdir /localhost + fi + bindfs --create-for-user="$GEODESIC_HOST_UID" --create-for-group="$GEODESIC_HOST_GID" /localhost.bindfs /localhost +fi +cd $GEODESIC_WORKDIR diff --git a/rootfs/templates/wrapper b/rootfs/templates/wrapper index 2814b863e..8767ea7cc 100755 --- a/rootfs/templates/wrapper +++ b/rootfs/templates/wrapper @@ -83,6 +83,10 @@ function use() { DOCKER_ARGS=() fi + if [ "${OS}" == 'Linux' ]; then + DOCKER_ARGS+=(--env GEODESIC_HOST_UID="$(id -u)" --env GEODESIC_HOST_GID="$(id -g)") + fi + if [ "${WITH_DOCKER}" == "true" ]; then # Bind-mount docker socket into container # Should work on Linux and Mac. @@ -155,11 +159,11 @@ function use() { if [ "${local_home}" == "/localhost" ]; then echo "WARNING: not mounting ${local_home} because it conflicts with geodesic" else - echo "# Mounting ${local_home} into container with workdir ${GEODESIC_HOST_CWD}" - DOCKER_ARGS+=( - --volume="${local_home}:/localhost" - --env LOCAL_HOME="${local_home}" - ) + LOCALHOST="localhost" + [ "${OS}" == 'Linux' ] && LOCALHOST="localhost.bindfs" + echo "# Mounting ${local_home} into container" + DOCKER_ARGS+=(--volume=${local_home}:/$LOCALHOST) + DOCKER_ARGS+=(--env LOCAL_HOME=${local_home}) fi DOCKER_ARGS+=(