1010# Creates all prereq images (delphi_database, delphi_python) only if they don't
1111# exist. If you need to rebuild a prereq, you're probably doing something
1212# complicated, and can figure out the rebuild command on your own.
13- #
14- #
13+ #
14+ #
1515# Commands:
16- #
16+ #
1717# web: Stops currently-running delphi_web_epidata instances, if any.
1818# Rebuilds delphi_web_epidata image.
1919# Runs image in the background and pipes stdout to a log file.
20- #
20+ #
2121# db: Stops currently-running delphi_database_epidata instances, if any.
2222# Rebuilds delphi_database_epidata image.
2323# Runs image in the background and pipes stdout to a log file.
2424# Blocks until database is ready to receive connections.
25- #
25+ #
2626# python: Rebuilds delphi_web_python image. You shouldn't need to do this
2727# often; only if you are installing a new environment, or have
2828# made changes to delphi-epidata/dev/docker/python/Dockerfile.
3535#
3636# clean: Cleans up dangling Docker images.
3737#
38- #
38+ #
3939# Optional arguments:
4040# pdb=1 Drops you into debug mode upon test failure, if running tests.
4141# test= Only runs tests in the directories provided here, e.g.
9494 docker stop $(DATABASE_CONTAINER_ID ) ; \
9595 fi
9696
97+ @# Setup virtual network if it doesn't exist
98+ @docker network ls | grep delphi-net || docker network create --driver bridge delphi-net
99+
97100 @# Only build prereqs if we need them
98101 @docker images delphi_database | grep delphi || \
99102 docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .
@@ -105,11 +108,12 @@ db:
105108 @# Run the database
106109 @docker run --rm -p 127.0.0.1:13306:3306 \
107110 --network delphi-net --name delphi_database_epidata \
111+ --cap-add =sys_nice \
108112 delphi_database_epidata >$(LOG_DB ) 2>&1 &
109113
110114 @# Block until DB is ready
111115 @while true; do \
112- sed -n '/Temporary server stopped/,/ mysqld: ready for connections/p' $(LOG_DB) | grep "ready for connections" && break; \
116+ sed -n '/mysqld: ready for connections/p' $(LOG_DB) | grep "ready for connections" && break; \
113117 tail -1 $(LOG_DB); \
114118 sleep 1; \
115119 done
@@ -124,10 +128,10 @@ py:
124128 -f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
125129
126130.PHONY =all
127- all : web db py
131+ all : db web py
128132
129133.PHONY =test
130- test :
134+ test :
131135 @docker run -i --rm --network delphi-net \
132136 --mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
133137 --mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
0 commit comments