Sha256: 78bc47c4ae72eaf437994e4974deb60ae7e823eff9d80596531c15133b81c2bd

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

#!/bin/bash
set -e -x

build_image=outstand/consul_stockpile:dev
dockerfile=Dockerfile
bundler_data_dir=tmp

bundler_data_container=''
tar_container=''

function cleanup {
  if [ -n "$bundler_data_container" ]; then
    docker stop bundler-data
    docker rm -fv bundler-data
  fi

  if [ -n "$tar_container" ]; then
    docker rm -fv ${tar_container}
  fi

  rm -f ${bundler_data_dir}/cidfile
}

trap cleanup EXIT

build_args=''
mkdir -p ${bundler_data_dir}

if [ -f $(pwd)/${bundler_data_dir}/bundler-data.tar.gz ]; then
  docker run --name bundler-data -v $(pwd)/${bundler_data_dir}/bundler-data.tar.gz:/usr/share/nginx/html/bundler-data.tar.gz:ro -d nginx:stable-alpine
  bundler_data_container=bundler-data
  build_args="--build-arg bundler_data_host=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' bundler-data)"
fi

docker build -t ${build_image} -f ${dockerfile} ${build_args} .

docker run -t --cidfile=${bundler_data_dir}/cidfile -w /usr/local/bundle ${build_image} tar -zcf /tmp/bundler-data.tar.gz .
tar_container=$(cat ${bundler_data_dir}/cidfile)
docker cp ${tar_container}:/tmp/bundler-data.tar.gz ${bundler_data_dir}/bundler-data.tar.gz

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
consul_stockpile-0.1.5 build_dev.sh