Last active
January 27, 2016 17:17
-
-
Save mefellows/09c09b49459fecd0fe51 to your computer and use it in GitHub Desktop.
Dockerizing CI environments blog post
This file contains 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
api: | |
build: . | |
ports: | |
- "8000:80" | |
expose: | |
- "80" | |
test: | |
build: test | |
command: dockerize -wait http://api:80 go test -v ./... | |
links: | |
- api:api |
This file contains 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
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 |
This file contains 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
dockerize -wait tcp://web:80 -wait http://web:80 |
This file contains 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
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