generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
91 lines (84 loc) · 2.35 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
---
version: "3.9"
x-var:
- &POSTGRES_USER postgres
- &POSTGRES_PASSWORD default
- &POSTGRES_DATABASE postgres
- &POSTGRES_HOST localhost:5432
- &POSTGRES_SCHEMA ENMODS
x-postgres-vars: &postgres-vars
POSTGRES_HOST: *POSTGRES_HOST
POSTGRES_USER: *POSTGRES_USER
POSTGRES_PASSWORD: *POSTGRES_PASSWORD
POSTGRES_DATABASE: *POSTGRES_DATABASE
POSTGRES_SCHEMA: *POSTGRES_SCHEMA
services:
database:
image: postgres:15
container_name: database
environment:
<<: *postgres-vars
healthcheck:
test: ["CMD", "pg_isready", "-U", *POSTGRES_USER]
ports: ["5432:5432"]
migrations:
image: flyway/flyway:9-alpine
container_name: migrations
command: info migrate info
volumes: ["./migrations/sql:/flyway/sql:ro"]
environment:
FLYWAY_URL: jdbc:postgresql://database:5432/postgres
FLYWAY_USER: *POSTGRES_USER
FLYWAY_PASSWORD: *POSTGRES_PASSWORD
FLYWAY_BASELINE_ON_MIGRATE: true
FLYWAY_DEFAULT_SCHEMA: *POSTGRES_SCHEMA
depends_on:
database:
condition: service_healthy
backend:
container_name: backend
entrypoint: sh -c "npm i && npm run start:dev"
environment:
<<: *postgres-vars
NODE_ENV: development
image: node:20-bullseye
ports: ["3001:3000"]
volumes: ["./backend:/app", "/app/node_modules"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api"]
working_dir: "/app"
depends_on:
migrations:
condition: service_started
frontend:
container_name: frontend
entrypoint: sh -c "npm ci && npm run dev"
environment:
NODE_ENV: development
PORT: 3000
BACKEND_URL: http://backend:3000
image: node:20-bullseye
ports: ["3000:3000"]
volumes: ["./frontend:/app", "/app/node_modules"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
working_dir: "/app"
depends_on:
backend:
condition: service_healthy
caddy:
container_name: caddy
profiles: ["caddy"]
build: ./frontend
environment:
NODE_ENV: development
PORT: 3000
BACKEND_URL: http://backend:3000
LOG_LEVEL: info
ports: ["3005:3000"]
volumes: ["./frontend/Caddyfile:/etc/caddy/Caddyfile"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
depends_on:
backend:
condition: service_healthy