Sha256: 0a05b5bce515e6d28645b28d1feec8e6da693b575f27a7d65a5d571a2a7b5be9

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

#!/bin/bash
MINKE_VERSION="1.13.18"

DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
NEW_UUID=$(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]')

DOCKER_IMAGE="nicholasjackson/minke:${MINKE_VERSION}"

COMMAND=$*

GEM_VOLUMES=""

# Test if interactive terminal and set the flag
[[ -t 1 ]] && IT="-it" || IT=""

if [[ $1 != \generate* ]]; then
  # Test if we need to mount any special volumes for paths specified in the Gemfile
  while read -r line; do
    if [[ $line != \#* ]]; then
      l=$(echo $line | sed "s/.*:path *=> *//" | sed "s/['|\"]\(.*\)['|\"]/\1/")
      GEM_VOLUMES="${GEM_VOLUMES} -v $l:$l"
    fi
  done < <(grep :path Gemfile)

  DIR=$(dirname `pwd`)
  DOCKER_RUN="docker run ${IT} --rm --net=minke_${NEW_UUID} ${GEM_VOLUMES} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -e BUNDLE_PATH=${PWD}/vendor -e BUNDLE_JOBS=2 -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR}/_build ${DOCKER_IMAGE} ${COMMAND}"

  echo "Running command: minke ${COMMAND}"

  id=$(docker network create minke_${NEW_UUID})
  #echo "${DOCKER_RUN}"
  eval "${DOCKER_RUN}"
  id=$(docker network rm minke_${NEW_UUID})
fi

if [[ $1 = \generate* ]]; then
  DIR=$(pwd)
  DOCKER_RUN="docker run --rm -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -w ${DIR}:${DIR} ${DOCKER_IMAGE} ${COMMAND}"
  echo $DOCKER_RUN 
  eval "$DOCKER_RUN"
fi

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minke-1.13.18 lib/minke/scripts/minke