Skip to content

Instantly share code, notes, and snippets.

@mefellows
Last active January 27, 2016 17:17
Show Gist options
  • Save mefellows/09c09b49459fecd0fe51 to your computer and use it in GitHub Desktop.
Save mefellows/09c09b49459fecd0fe51 to your computer and use it in GitHub Desktop.
Dockerizing CI environments blog post
api:
build: .
ports:
- "8000:80"
expose:
- "80"
test:
build: test
command: dockerize -wait http://api:80 go test -v ./...
links:
- api:api
RUN apt-get update && apt-get install -y wget
RUN wget https://github.com/jwilder/dockerize/releases/download/v0.1.0/dockerize-linux-amd64-v0.1.0.tar.gz
RUN tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.1.0.tar.gz
dockerize -wait tcp://web:80 -wait http://web:80
echo ">> Waiting for postgres to start"
WAIT=0
while ! nc -z $POSTGRES_HOST 5432; do
sleep 1
WAIT=$(($WAIT + 1))
if [ "$WAIT" -gt 15 ]; then
echo "Error: Timeout wating for Postgres to start"
exit 1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment