Sha256: 1c81dc6cbe493b0a0aa2e1d0809c8e1af558433e02f9293ea0fd2590c168d778

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

#!/bin/bash

set -euo pipefail

su-exec ${FIXUID:?Missing FIXUID var}:${FIXGID:?Missing FIXGID var} fixuid

chown_dir() {
  dir=$1
  if [[ -d ${dir} ]] && [[ "$(stat -c %u:%g ${dir})" != "${FIXUID}:${FIXGID}" ]]; then
    echo chown $dir
    chown sycamore:sycamore $dir
  fi
}

chown_dir /usr/local/bundle
chown_dir /home/sycamore/.local/share/gem
chown_dir /home/sycamore/.gem

if [ "$(which "$1")" = '' ]; then
  if [ "$(ls -A /usr/local/bundle/bin)" = '' ]; then
    echo 'command not in path and bundler not initialized'
    echo 'running bundle install'
    su-exec sycamore bundle install
  fi
fi

if [ "$1" = 'bundle' ]; then
  set -- su-exec sycamore "$@"
elif [ "$1" = 'rake' ]; then
  set -- su-exec sycamore bundle exec "$@"

  su-exec sycamore bash -c 'bundle check || bundle install'
elif ls /usr/local/bundle/bin | grep -q "\b$1\b"; then
  set -- su-exec sycamore bundle exec "$@"

  su-exec sycamore bash -c 'bundle check || bundle install'
fi

exec "$@"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
outstand-sycamore-0.4.0 docker-entrypoint.sh
outstand-sycamore-0.4.0.pre docker-entrypoint.sh