Skip to content

Instantly share code, notes, and snippets.

@mikeclarke
Created November 23, 2013 21:43
Show Gist options
  • Save mikeclarke/7620336 to your computer and use it in GitHub Desktop.
Save mikeclarke/7620336 to your computer and use it in GitHub Desktop.
Wrapper script for dealing with environment variables set by the `-link container_name:db` argument. The Dockerfile `ENV` directive will set a static environment variable inside the container, but it's not possible to reference dynamic environment variables (at least not very easily) with ENV. This script should be set as the `ENTRYPOINT` in an …
#!/bin/bash
# Docker doesn't have a great way to set runtime environment variables,
# so use this script to prepare the execution environnment for later processes.
export SQLALCHEMY_DATABASE_URI="postgresql://${DB_PORT_5432_TCP_ADDR}:5432/database_name"
# Execute the commands passed to this script
# e.g. "./env.sh venv/bin/nosetests --with-xunit
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment