diff --git a/dev/local/Makefile b/dev/local/Makefile index da910bd86..75b10554c 100644 --- a/dev/local/Makefile +++ b/dev/local/Makefile @@ -67,6 +67,11 @@ LOG_DB:=delphi_database_epidata_$(NOW).log WEB_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_web_epidata') DATABASE_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_database_epidata') +M1= +ifeq ($(shell uname -smp), Darwin arm64 arm) +$(info M1 system detected, changing docker platform to linux/amd64.) + override M1 =--platform linux/amd64 +endif .PHONY=web web: @@ -80,11 +85,14 @@ web: @# Build the web_epidata image @cd repos/delphi/delphi-epidata;\ - docker build -t delphi_web_epidata -f ./devops/Dockerfile .;\ + docker build -t delphi_web_epidata\ + $(M1) \ + -f ./devops/Dockerfile .;\ cd - @# Run the web server @docker run --rm -p 127.0.0.1:10080:80 \ + $(M1) \ --env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \ --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "LOG_DEBUG" \ --network delphi-net --name delphi_web_epidata \ @@ -102,10 +110,12 @@ db: @# Build the database_epidata image @docker build -t delphi_database_epidata \ + $(M1) \ -f repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile . @# Run the database @docker run --rm -p 127.0.0.1:13306:3306 \ + $(M1) \ --network delphi-net --name delphi_database_epidata \ --cap-add=sys_nice \ delphi_database_epidata >$(LOG_DB) 2>&1 & @@ -120,6 +130,7 @@ db: .PHONY=py py: @docker build -t delphi_web_python \ + $(M1) \ -f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile . .PHONY=all @@ -128,6 +139,7 @@ all: db web py .PHONY=test test: @docker run -i --rm --network delphi-net \ + $(M1) \ --mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \ --mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \ --env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \ @@ -137,6 +149,7 @@ test: .PHONY=bash bash: @docker run -it --rm --network delphi-net \ + $(M1) \ --mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \ --mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \ --env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \