Skip to content

Commit 8ba2a1b

Browse files
committed
Docker infrastructure for new redis event listener container
1 parent 2f707da commit 8ba2a1b

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ RUN pip install -e /src
1414
COPY tests/ /tests/
1515

1616
WORKDIR /src
17-
ENV FLASK_APP=allocation/flask_app.py FLASK_DEBUG=1 PYTHONUNBUFFERED=1
18-
CMD flask run --host=0.0.0.0 --port=80

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
build:
22
docker-compose build
33

4-
api:
5-
docker-compose up -d app
4+
services:
5+
docker-compose up -d
66

77
test:
8-
docker-compose run --rm --entrypoint='pytest /tests' app
8+
docker-compose run --rm --entrypoint='pytest /tests' api
99

1010
unit-tests:
11-
docker-compose run --rm --entrypoint='pytest /tests/unit' app
11+
docker-compose run --rm --entrypoint='pytest /tests/unit' api
1212

1313
integration-tests:
14-
docker-compose run --rm --entrypoint='pytest /tests/integration' app
14+
docker-compose run --rm --entrypoint='pytest /tests/integration' api
1515

1616
e2e-tests:
17-
docker-compose run --rm --entrypoint='pytest /tests/e2e' app
17+
docker-compose run --rm --entrypoint='pytest /tests/e2e' api
1818

1919
logs:
20-
docker-compose logs app | tail -100
20+
docker-compose logs --tail=25 api redis_pubsub
2121

2222
down:
2323
docker-compose down --remove-orphans
2424

25-
all: down build api test
25+
all: down build services test

docker-compose.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,51 @@
11
version: "3"
2+
23
services:
34

4-
app:
5+
redis_pubsub:
56
build:
67
context: .
78
dockerfile: Dockerfile
9+
image: allocation-image
810
depends_on:
911
- postgres
1012
- redis
1113
environment:
1214
- DB_HOST=postgres
1315
- DB_PASSWORD=abc123
14-
- API_HOST=app
16+
- REDIS_HOST=redis
1517
- PYTHONDONTWRITEBYTECODE=1
1618
volumes:
1719
- ./src:/src
1820
- ./tests:/tests
21+
entrypoint:
22+
- python
23+
- /src/allocation/redis_pubsub.py
24+
25+
api:
26+
image: allocation-image
27+
depends_on:
28+
- redis_pubsub
29+
environment:
30+
- DB_HOST=postgres
31+
- DB_PASSWORD=abc123
32+
- API_HOST=api
33+
- REDIS_HOST=redis
34+
- PYTHONDONTWRITEBYTECODE=1
35+
- FLASK_APP=allocation/flask_app.py
36+
- FLASK_DEBUG=1
37+
- PYTHONUNBUFFERED=1
38+
volumes:
39+
- ./src:/src
40+
- ./tests:/tests
41+
entrypoint:
42+
- flask
43+
- run
44+
- --host=0.0.0.0
45+
- --port=80
1946
ports:
2047
- "5005:80"
2148

22-
2349
postgres:
2450
image: postgres:9.6
2551
environment:

0 commit comments

Comments
 (0)