forked from bcgov/sample-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
75 lines (68 loc) · 1.94 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
x-var:
- &POSTGRES_USER
postgres
- &POSTGRES_PASSWORD
default
- &POSTGRES_DATABASE
postgres
x-flyway-vars: &flyway-vars
FLYWAY_URL: jdbc:postgresql://sampledb:5432/postgres
FLYWAY_USER: *POSTGRES_USER
FLYWAY_PASSWORD: *POSTGRES_PASSWORD
FLYWAY_BASELINE_ON_MIGRATE: "true"
x-postgres-vars: &postgres-vars
POSTGRES_HOST: sampledb
POSTGRES_USER: *POSTGRES_USER
POSTGRES_PASSWORD: *POSTGRES_PASSWORD
POSTGRES_DATABASE: *POSTGRES_DATABASE
x-python-vars: &python-vars
PIP_NO_CACHE_DIR: "false"
PIP_DISABLE_PIP_VERSION_CHECK: "true"
PIP_DEFAULT_TIMEOUT: 100
POETRY_VERSION: 1.8.3
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:
housing-unit-tests:
profiles: ["test"]
image: python:3.12
container_name: housing-unit-tests
entrypoint: /application/run-unit-tests.sh
volumes: [".:/application", "/application/.venv"]
database:
image: postgres:15
container_name: sampledb
environment:
<<: *postgres-vars
healthcheck:
test: ["CMD", "pg_isready", "-U", *POSTGRES_USER]
ports: ["5432:5432"]
housing-migration:
image: flyway/flyway:10
container_name: housing-migration
command: info migrate info
volumes: ["./db/migrations:/flyway/sql:ro"]
environment:
<<: *flyway-vars
FLYWAY_DEFAULT_SCHEMA: housing
depends_on:
database:
condition: service_healthy
housing-api:
# image: ghcr.io/vancwo/sample-api:main # If you want to use a prebuilt docker image, uncomment this and remove the build: key
build:
context: .
dockerfile: Dockerfile
container_name: housing-api
environment:
<<: [*postgres-vars, *python-vars]
ports: ["3003:3000"]
depends_on:
housing-migration:
condition: service_started