generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
100 lines (94 loc) · 2.23 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
# Reusable vars
x-var:
- &POSTGRES_USER
postgres
# Postgres envars
x-postgres-vars: &postgres-vars
POSTGRES_DATABASE: postgres
POSTGRES_HOST: nr-nmp-db
POSTGRES_PASSWORD: default
POSTGRES_USER: *POSTGRES_USER
name: nr-nmp
services:
# DB
database:
build:
context: ./database
dockerfile: Dockerfile
container_name: nr-nmp-db
environment:
<<: *postgres-vars
ports: [5432:5432]
healthcheck:
test: ["CMD", "pg_isready", "-U", *POSTGRES_USER]
# PGAdmin
pgadmin:
container_name: nr-nmp-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
image: dpage/pgadmin4
ports: [5050:80]
profiles: ["pgadmin"]
# Backend
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: nr-nmp-api
depends_on:
database:
condition: service_healthy
develop:
watch:
- action: sync
path: ./backend/
target: app
env_file: .env
environment:
LOG_LEVEL: info
PORT: 3000
<<: *postgres-vars
healthcheck:
test: curl --fail http://localhost:3000 || exit 1
ports: ["3000:3000"]
# For debugging
stdin_open: true
tty: true
# Frontend
frontend:
image: node:20.17.0
command: /bin/bash -c "cd ./app && npm install && npm run ${CMD:-dev}"
container_name: nr-nmp-frontend
depends_on:
backend:
condition: service_healthy
develop:
watch:
- action: sync
path: ./frontend
target: /app
ignore: [node_modules]
env_file: .env
environment:
VITE_BACKEND_URL: http://localhost:3000
healthcheck:
test: curl --fail http://localhost:5173 || exit 1
ports: ["5173:5173"]
volumes: ["./frontend:/app", "/app/node_modules"]
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:3005"]
depends_on:
backend:
condition: service_healthy