Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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