Skip to content

Commit cb005b2

Browse files
committed
fix: can't pass env to compose up, use env vars
1 parent fdcdb08 commit cb005b2

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

.github/workflows/ci.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ jobs:
5656
ln -s repos/delphi/delphi-epidata/dev/local/pyproject.toml repos/
5757
ln -s repos/delphi/delphi-epidata/dev/local/setup.cfg repos/
5858
59-
- name: Build docker images
60-
run: |
61-
make db
62-
make web
63-
make redis
64-
6559
- name: Run tests
6660
run: |
6761
make test

dev/local/Makefile

+6-9
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ NOW:=$(shell date "+%Y-%m-%d")
6565
LOG_WEB:=delphi_web_epidata_$(NOW).log
6666
LOG_DB:=delphi_database_epidata_$(NOW).log
6767
LOG_REDIS:=delphi_redis_instance_$(NOW).log
68-
WEB_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_web_epidata')
69-
DATABASE_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_database_epidata')
70-
REDIS_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_redis')
7168

7269
M1=
7370
ifeq ($(shell uname -smp), Darwin arm64 arm)
@@ -82,9 +79,7 @@ db:
8279

8380
.PHONY=web
8481
web:
85-
@docker compose up delphi_web_epidata $(M1) \
86-
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
87-
--detach
82+
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose up delphi_web_epidata $(M1) --detach
8883
@docker logs -f delphi_web_epidata >$(LOG_WEB) 2>&1 &
8984

9085
.PHONY=redis
@@ -94,15 +89,17 @@ redis:
9489

9590
.PHONY=test
9691
test:
97-
@docker compose run delphi_web_python $(M1) python -m pytest --import-mode importlib $(pdb) $(test) | tee test_output_$(NOW).log
92+
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose run delphi_web_python $(M1) \
93+
python -m pytest --import-mode importlib $(pdb) $(test) | tee test_output_$(NOW).log
9894

9995
.PHONY=r-test
10096
r-test:
101-
@docker compose run delphi_web_python $(M1) Rscript repos/delphi/delphi-epidata/integrations/client/test_delphi_epidata.R | tee r-test_output_$(NOW).log
97+
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose run delphi_web_python $(M1) \
98+
Rscript repos/delphi/delphi-epidata/integrations/client/test_delphi_epidata.R | tee r-test_output_$(NOW).log
10299

103100
.PHONY=bash
104101
bash:
105-
@docker compose run delphi_web_python $(M1) bash
102+
@SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) docker compose run delphi_web_python $(M1) bash
106103

107104
.PHONY=sql
108105
sql:

dev/local/docker-compose.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
dockerfile: ./devops/Dockerfile
2828
environment:
2929
MODULE_NAME: delphi.epidata.server.main
30-
SQLALCHEMY_DATABASE_URI: mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
30+
SQLALCHEMY_DATABASE_URI: ${SQLALCHEMY_DATABASE_URI:-mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata}
3131
FLASK_SECRET: abc
3232
FLASK_PREFIX: /epidata
3333
LOG_DEBUG: "1"
@@ -68,7 +68,7 @@ services:
6868
context: .
6969
dockerfile: repos/delphi/delphi-epidata/dev/docker/python/Dockerfile
7070
environment:
71-
SQLALCHEMY_DATABASE_URI: mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
71+
SQLALCHEMY_DATABASE_URI: ${SQLALCHEMY_DATABASE_URI:-mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata}
7272
FLASK_SECRET: abc
7373
volumes:
7474
- type: bind

0 commit comments

Comments
 (0)