generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
130 lines (118 loc) · 3.55 KB
/
docker-compose.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
version: "3.9"
x-var:
- &POSTGRES_USER
postgres
- &POSTGRES_PASSWORD
default
- &POSTGRES_DATABASE
postgres
x-flyway-vars: &flyway-vars
FLYWAY_URL: jdbc:postgresql://database:5432/postgres
FLYWAY_USER: *POSTGRES_USER
FLYWAY_PASSWORD: *POSTGRES_PASSWORD
FLYWAY_BASELINE_ON_MIGRATE: true
x-postgres-vars: &postgres-vars
POSTGRES_HOST: database
POSTGRES_USER: *POSTGRES_USER
POSTGRES_PASSWORD: *POSTGRES_PASSWORD
POSTGRES_DATABASE: *POSTGRES_DATABASE
x-python-vars: &python-vars
PIP_NO_CACHE_DIR: off
PIP_DISABLE_PIP_VERSION_CHECK: on
PIP_DEFAULT_TIMEOUT: 100
POETRY_VERSION: 1.2.2
POETRY_HOME: /opt/poetry
POETRY_VIRTUALENVS_IN_PROJECT: true
POETRY_NO_INTERACTION: 1
PYSETUP_PATH: /application
VENV_PATH: /application/.venv
PYTHONDONTWRITEBYTECODE: 1
PYTHONUNBUFFERED: 1
PYTHONPATH: /application/app/src
services:
database:
image: postgres:15
container_name: database
environment:
<<: *postgres-vars
healthcheck:
test: ["CMD", "pg_isready", "-U", *POSTGRES_USER]
ports: ["5432:5432"]
migrations-go:
profiles: ["go", "all"]
image: flyway/flyway:9-alpine
container_name: migrations-go
command: info migrate info
volumes: ["./backend-go/db/migrations:/flyway/sql:ro"]
environment:
<<: *flyway-vars
FLYWAY_DEFAULT_SCHEMA: go_api
depends_on:
database:
condition: service_healthy
migrations-py:
profiles: ["python", "all"]
image: flyway/flyway:9-alpine
container_name: migrations-py
command: info migrate info
volumes: ["./backend-py/db/migrations:/flyway/sql:ro"]
environment:
<<: *flyway-vars
FLYWAY_DEFAULT_SCHEMA: py_api
depends_on:
database:
condition: service_healthy
backend-go:
profiles: ["go", "all"]
image: cosmtrek/air:latest
working_dir: /app # has to be the same as mapped vol
volumes: ["./backend-go/:/app", "/app/docs", "/app/tmp"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
container_name: backend-go
environment:
<<: *postgres-vars
entrypoint: sh -c "go install github.com/swaggo/swag/cmd/swag@latest && swag init && swag fmt && /go/bin/air"
ports: ["3005:3000"]
depends_on:
migrations-go:
condition: service_started
backend-py-model-generator:
profiles: ["python", "all"]
image: python:3.11-slim-buster # DO NOT change, as it breaks the module.
container_name: backend-py-model-generator
environment:
<<: *postgres-vars
entrypoint: /app/generate-models.sh
volumes:
- "./backend-py/src/v1/models:/app/models"
- "./backend-py/generate-models.sh:/app/generate-models.sh"
depends_on:
migrations-py:
condition: service_completed_successfully
backend-py:
profiles: ["python", "all"]
image: python:3.13
container_name: backend-py
entrypoint: /application/start-local.sh
volumes: ["./backend-py:/application", "/application/.venv"]
healthcheck:
test: timeout 10s bash -c 'true > /dev/tcp/127.0.0.1/3000'
environment:
<<: [*postgres-vars, *python-vars]
ports: ["3003:3000"]
depends_on:
backend-py-model-generator:
condition: service_started
backend-py-test:
profiles: ["python", "all"]
image: python:3.13
container_name: backend-py-test
entrypoint: /application/run-unit-tests.sh
volumes: ["./backend-py:/application", "/application/.venv"]
environment:
<<: [*postgres-vars, *python-vars]
depends_on:
backend-py:
condition: service_healthy