Created
January 5, 2017 01:28
-
-
Save brienw/7755c990b7260f5f0c885c8bf81facb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export MIX_ENV=${MIX_ENV:-prod} | |
if [ -f /.dockerenv ]; then | |
# We are inside a docker container, so lets build a release | |
if [ -n "${APP_NAME:+set}" ]; then | |
echo ">>> BUILDING $APP_NAME <<<" | |
mix release --env=$MIX_ENV --name=$APP_NAME | |
else | |
echo ">>> BUILDING RELEASE <<<" | |
mix release --env=$MIX_ENV | |
fi | |
echo ">>> BUILD COMPLETE <<<" | |
elif [[ "$(docker images -q clickbank_build:latest 2> /dev/null)" != "" ]]; then | |
# We have the build image, so lets run it! | |
echo ">> RUNNING BUILD IMAGE <<" | |
docker run -e APP_NAME=$1 -e MIX_ENV=$MIX_ENV -v $PWD/:/app clickbank_build | |
else | |
# We're just starting off, so lets build the docker image | |
echo "> BUILDING DOCKER BUILD IMAGE <" | |
docker build --tag clickbank_build -f Dockerfile-build_env . | |
./build.sh | |
fi | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment