-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose-test.yml
88 lines (82 loc) · 2.4 KB
/
docker-compose-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
version: "3.8"
services:
postgres:
image: pgautoupgrade/pgautoupgrade:latest
ports:
- "5432:5432"
command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
restart: unless-stopped
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
volumes:
- ./init-test-db.sh:/docker-entrypoint-initdb.d/init-test-db.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
flask:
build:
context: . # Set build context to the root of the project
dockerfile: Dockerfile # Ensure this path is correct
ports:
- "5000:5000"
environment:
OWL_ENV_FILE: ".env.test"
FLASK_RUN_HOST: "0.0.0.0"
FLASK_ENV: development
SQLALCHEMY_DATABASE_URI: "postgresql://postgres:postgres@postgres:5432/test"
STORAGE_BASE_PATH: "/app/storage"
HOST_UID: "${HOST_UID:-1000}"
HOST_GID: "${HOST_GID:-1000}"
depends_on:
- postgres
volumes:
- .:/owl
# entrypoint: ["/owl/test-entrypoint.sh"]
command:
["sh", "-c", "./wait-for-postgres.sh postgres owl runserver -h '0.0.0.0'"]
migrate:
build:
context: . # Set build context to the root of the project
dockerfile: Dockerfile # Ensure this path is correct
environment:
SQLALCHEMY_DATABASE_URI: "postgresql://postgres:postgres@postgres:5432/test"
OWL_ENV_FILE: ".env.test"
entrypoint: ["sh", "-c", "flask db upgrade -d owl/server/app/migrations"]
depends_on:
- postgres
volumes:
- .:/owl
test:
build:
context: . # Set build context to the root of the project
dockerfile: Dockerfile # Ensure this path is correct]
command:
[
"sh",
"-c",
"./wait-for-flask.sh flask 5000 pytest -s -x -o log_cli=true -o log_cli_level=DEBUG",
]
depends_on:
- postgres
- migrate
- flask
volumes:
- .:/owl
environment:
OWL_ENV_FILE: ".env.test"
STORAGE_BASE_PATH: "/app/storage"
FLASK_API_URL: "http://flask:5000" # Add this if your tests need to access the Flask service
LOG_LEVEL: "DEBUG"
bandit:
build:
context: . # Set build context to the root of the project
dockerfile: Dockerfile
command: ["sh", "-c", "bandit -r owl/server/app"]
volumes:
- .:/owl
environment:
OWL_ENV_FILE: ".env.test"
volumes:
flask_venv: