tracks/script/docker-environment
2018-05-02 16:08:41 -05:00

16 lines
478 B
Bash
Executable file

#!/bin/sh
# Run a command in the app's environment
set -e
# Find our app dir and just run the command in we're in the container since the
# container is built with an /etc/app-env file inside of it.
appdir=$(cd $(dirname "$0")/.. && pwd)
[ -f /etc/app-env ] && exec "$@"
# Otherwise, run docker compose to run our command in the container
cmd="$@"; [ "$#" -eq 0 ] && cmd=bash
export VOLUME="$appdir:/app"
image=${DOCKER_IMAGE:=web}
exec docker-compose run --rm $image $cmd