10
10
# Creates all prereq images (delphi_database, delphi_python) only if they don't
11
11
# exist. If you need to rebuild a prereq, you're probably doing something
12
12
# complicated, and can figure out the rebuild command on your own.
13
- #
14
- #
13
+ #
14
+ #
15
15
# Commands:
16
- #
16
+ #
17
17
# web: Stops currently-running delphi_web_epidata instances, if any.
18
18
# Rebuilds delphi_web_epidata image.
19
19
# Runs image in the background and pipes stdout to a log file.
20
- #
20
+ #
21
21
# db: Stops currently-running delphi_database_epidata instances, if any.
22
22
# Rebuilds delphi_database_epidata image.
23
23
# Runs image in the background and pipes stdout to a log file.
24
24
# Blocks until database is ready to receive connections.
25
- #
25
+ #
26
26
# python: Rebuilds delphi_web_python image. You shouldn't need to do this
27
27
# often; only if you are installing a new environment, or have
28
28
# made changes to delphi-epidata/dev/docker/python/Dockerfile.
35
35
#
36
36
# clean: Cleans up dangling Docker images.
37
37
#
38
- #
38
+ #
39
39
# Optional arguments:
40
40
# pdb=1 Drops you into debug mode upon test failure, if running tests.
41
41
# test= Only runs tests in the directories provided here, e.g.
94
94
docker stop $(DATABASE_CONTAINER_ID ) ; \
95
95
fi
96
96
97
+ @# Setup virtual network if it doesn't exist
98
+ @docker network ls | grep delphi-net || docker network create --driver bridge delphi-net
99
+
97
100
@# Only build prereqs if we need them
98
101
@docker images delphi_database | grep delphi || \
99
102
docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .
@@ -105,11 +108,12 @@ db:
105
108
@# Run the database
106
109
@docker run --rm -p 127.0.0.1:13306:3306 \
107
110
--network delphi-net --name delphi_database_epidata \
111
+ --cap-add =sys_nice \
108
112
delphi_database_epidata >$(LOG_DB ) 2>&1 &
109
113
110
114
@# Block until DB is ready
111
115
@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; \
113
117
tail -1 $(LOG_DB); \
114
118
sleep 1; \
115
119
done
@@ -124,10 +128,10 @@ py:
124
128
-f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
125
129
126
130
.PHONY =all
127
- all : web db py
131
+ all : db web py
128
132
129
133
.PHONY =test
130
- test :
134
+ test :
131
135
@docker run -i --rm --network delphi-net \
132
136
--mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
133
137
--mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
0 commit comments