Skip to content

Commit 734dd0d

Browse files
committed
replace optional argument with auto identify M1 platform using uname
1 parent ab0613c commit 734dd0d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

dev/local/Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,11 @@
3737
# test= Only runs tests in the directories provided here, e.g.
3838
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
3939
# sql= Overrides the default SQL connection string.
40-
# m1=1 Mandatory if your local system uses Apple M1 chip
4140

4241
# Set optional argument defaults
43-
ifdef m1
44-
override m1 =--platform linux/amd64
45-
endif
4642

4743
ifdef pdb
48-
override =--pdb
44+
override pdb =--pdb
4945
else
5046
pdb=
5147
endif
@@ -71,6 +67,11 @@ LOG_DB:=delphi_database_epidata_$(NOW).log
7167
WEB_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_web_epidata')
7268
DATABASE_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_database_epidata')
7369

70+
M1=
71+
UNAME := $(shell uname -smp)
72+
ifeq ($(UNAME), Darwin arm64 arm)
73+
override M1 =--platform linux/amd64
74+
endif
7475

7576
.PHONY=web
7677
web:
@@ -85,13 +86,13 @@ web:
8586
@# Build the web_epidata image
8687
@cd repos/delphi/delphi-epidata;\
8788
docker build -t delphi_web_epidata\
88-
$(m1) \
89+
$(M1) \
8990
-f ./devops/Dockerfile .;\
9091
cd -
9192

9293
@# Run the web server
9394
@docker run --rm -p 127.0.0.1:10080:80 \
94-
$(m1) \
95+
$(M1) \
9596
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
9697
--env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "LOG_DEBUG" \
9798
--network delphi-net --name delphi_web_epidata \
@@ -109,12 +110,12 @@ db:
109110

110111
@# Build the database_epidata image
111112
@docker build -t delphi_database_epidata \
112-
$(m1) \
113+
$(M1) \
113114
-f repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
114115

115116
@# Run the database
116117
@docker run --rm -p 127.0.0.1:13306:3306 \
117-
$(m1) \
118+
$(M1) \
118119
--network delphi-net --name delphi_database_epidata \
119120
--cap-add=sys_nice \
120121
delphi_database_epidata >$(LOG_DB) 2>&1 &
@@ -129,7 +130,7 @@ db:
129130
.PHONY=py
130131
py:
131132
@docker build -t delphi_web_python \
132-
$(m1) \
133+
$(M1) \
133134
-f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
134135

135136
.PHONY=all
@@ -138,7 +139,7 @@ all: db web py
138139
.PHONY=test
139140
test:
140141
@docker run -i --rm --network delphi-net \
141-
$(m1) \
142+
$(M1) \
142143
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
143144
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
144145
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
@@ -148,7 +149,7 @@ test:
148149
.PHONY=bash
149150
bash:
150151
@docker run -it --rm --network delphi-net \
151-
$(m1) \
152+
$(M1) \
152153
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
153154
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
154155
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \

0 commit comments

Comments
 (0)