Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Make dockerfile and server helper script more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Jan 30, 2017
1 parent 547e503 commit a2b17b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions conf/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

cd $(dirname $0)
case "$1" in
Expand Down
21 changes: 11 additions & 10 deletions server
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

HERE="$(pwd)"

Expand Down Expand Up @@ -60,7 +61,7 @@ case "$1" in
if [ ! -z "$SCHEDULER_ID" ]; then
$0 stop scheduler
fi
docker build --pull -t mozilla/ichnaea .
docker build -t mozilla/ichnaea .
docker run -d \
-e "REDIS_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_redis`" \
-e "DB_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_mysql`" \
Expand All @@ -73,7 +74,7 @@ case "$1" in
if [ ! -z "$WEB_ID" ]; then
$0 stop web
fi
docker build --pull -t mozilla/ichnaea .
docker build -t mozilla/ichnaea .
docker run -d \
-e "REDIS_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_redis`" \
-e "DB_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_mysql`" \
Expand All @@ -86,7 +87,7 @@ case "$1" in
if [ ! -z "$WORKER_ID" ]; then
$0 stop worker
fi
docker build --pull -t mozilla/ichnaea .
docker build -t mozilla/ichnaea .
docker run -d \
-e "REDIS_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_redis`" \
-e "DB_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_mysql`" \
Expand All @@ -95,11 +96,11 @@ case "$1" in

# Builds and starts the services supporting the application container.
services)
cd docker/mysql; docker build --pull -t mozilla/ichnaea_mysql:latest .
cd docker/mysql; docker build -t mozilla/ichnaea_mysql:latest .
cd $HERE
cd docker/redis; docker build --pull -t mozilla/ichnaea_redis:latest .
cd docker/redis; docker build -t mozilla/ichnaea_redis:latest .
cd $HERE
docker-compose build --pull
docker-compose build
docker-compose up -d
;;

Expand Down Expand Up @@ -165,7 +166,7 @@ case "$1" in
# Runs command inside the container.
run)
$0 start services
docker build --pull -t mozilla/ichnaea .
docker build -t mozilla/ichnaea .
docker run -it --rm \
-e "REDIS_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_redis`" \
-e "DB_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ichnaea_mysql`" \
Expand All @@ -181,7 +182,7 @@ case "$1" in

# Runs bower using a special node container.
bower_list)
cd docker/node; docker build --pull -t mozilla/ichnaea_node .
cd docker/node; docker build -t mozilla/ichnaea_node .
cd $HERE
docker run -it --rm \
--volume `pwd`:/app mozilla/ichnaea_node \
Expand All @@ -190,7 +191,7 @@ case "$1" in

# Updates CSS resources using a special node container.
css)
cd docker/node; docker build --pull -t mozilla/ichnaea_node .
cd docker/node; docker build -t mozilla/ichnaea_node .
cd $HERE
docker run -it --rm \
--volume `pwd`:/app mozilla/ichnaea_node \
Expand All @@ -204,7 +205,7 @@ case "$1" in

# Updates JS resources using a special node container.
js)
cd docker/node; docker build --pull -t mozilla/ichnaea_node .
cd docker/node; docker build -t mozilla/ichnaea_node .
cd $HERE
docker run -it --rm \
--volume `pwd`:/app mozilla/ichnaea_node \
Expand Down

0 comments on commit a2b17b9

Please sign in to comment.