make better use of the repo already copied into the containers

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
David Lawrence 2016-02-03 16:00:08 -08:00
parent 3cf25b9bbb
commit e891420d53
5 changed files with 24 additions and 15 deletions

View File

@ -5,25 +5,21 @@ notaryserver:
- notarymysql
- notarysigner
environment:
- SERVICE_NAME=notaryserver
volumes:
- ./migrations:/migrations
- SERVICE_NAME="notaryserver"
ports:
- "8080"
- "4443:4443"
entrypoint: /bin/bash
command: -c "/migrations/migrate.sh; notary-server -config=fixtures/server-config.json"
command: -c "./migrations/migrate.sh && notary-server -config=fixtures/server-config.json"
notarysigner:
build: .
dockerfile: signer.Dockerfile
links:
- notarymysql
environment:
- SERVICE_NAME=notarysigner
volumes:
- ./migrations:/migrations
- SERVICE_NAME="notarysigner"
entrypoint: /bin/bash
command: -c "/migrations/migrate.sh; notary-signer -config=fixtures/signer-config.json"
command: -c "./migrations/migrate.sh && notary-signer -config=fixtures/signer-config.json"
notarymysql:
volumes:
- ./notarymysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
@ -32,4 +28,4 @@ notarymysql:
ports:
- "3306:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
- MYSQL_ALLOW_EMPTY_PASSWORD="true"

View File

@ -1,18 +1,33 @@
#!/bin/bash
# When run in the docker containers, the working directory
# is the root of the repo.
iter=0
case $SERVICE_NAME in
notaryserver)
# have to poll for DB to come up
until migrate -path=/migrations/server/mysql -url="mysql://server@tcp(notarymysql:3306)/notaryserver" up
until migrate -path=migrations/server/mysql -url="mysql://server@tcp(notarymysql:3306)/notaryserver" up
do
((iter++))
if (( iter > 30 )); then
exit 1;
fi
echo "waiting for notarymysql to come up."
sleep 1
done
echo "notaryserver database migrated to latest version"
;;
notarysigner)
# have to poll for DB to come up
until migrate -path=/migrations/signer/mysql -url="mysql://signer@tcp(notarymysql:3306)/notarysigner" up
until migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(notarymysql:3306)/notarysigner" up
do
((iter++))
if (( iter > 30 )); then
exit 1;
fi
echo "waiting for notarymysql to come up."
sleep 1
done
echo "notarysigner database migrated to latest version"

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,5 +1,5 @@
FROM golang:1.5.3
MAINTAINER Diogo Monica "diogo@docker.com"
MAINTAINER David Lawrence "david.lawrence@docker.com"
RUN apt-get update && apt-get install -y \
libltdl-dev \

View File

@ -1,5 +1,5 @@
FROM golang:1.5.3
MAINTAINER Diogo Monica "diogo@docker.com"
MAINTAINER David Lawrence "david.lawrence@docker.com"
RUN apt-get update && apt-get install -y \
libltdl-dev \