Skip to content

Commit dfe47cf

Browse files
committedMar 1, 2024
Docker infrastructure for new redis event listener container
1 parent d1e2c86 commit dfe47cf

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed
 

‎Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ RUN pip install -e /src
1111
COPY tests/ /tests/
1212

1313
WORKDIR /src
14-
ENV FLASK_APP=allocation/entrypoints/flask_app.py FLASK_DEBUG=1 PYTHONUNBUFFERED=1
15-
CMD flask run --host=0.0.0.0 --port=80

‎Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ build:
88
docker-compose build
99

1010
up:
11-
docker-compose up -d app
11+
docker-compose up -d
1212

1313
down:
1414
docker-compose down --remove-orphans
1515

1616
test: up
17-
docker-compose run --rm --no-deps --entrypoint=pytest app /tests/unit /tests/integration /tests/e2e
17+
docker-compose run --rm --no-deps --entrypoint=pytest api /tests/unit /tests/integration /tests/e2e
1818

1919
unit-tests:
20-
docker-compose run --rm --no-deps --entrypoint=pytest app /tests/unit
20+
docker-compose run --rm --no-deps --entrypoint=pytest api /tests/unit
2121

2222
integration-tests: up
23-
docker-compose run --rm --no-deps --entrypoint=pytest app /tests/integration
23+
docker-compose run --rm --no-deps --entrypoint=pytest api /tests/integration
2424

2525
e2e-tests: up
26-
docker-compose run --rm --no-deps --entrypoint=pytest app /tests/e2e
26+
docker-compose run --rm --no-deps --entrypoint=pytest api /tests/e2e
2727

2828
logs:
29-
docker-compose logs app | tail -100
29+
docker-compose logs --tail=25 api redis_pubsub
3030

3131
black:
3232
black -l 86 $$(find * -name '*.py')

‎docker-compose.yml

+29-3
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/entrypoints/redis_eventconsumer.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/entrypoints/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)
Please sign in to comment.