-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
56 lines (52 loc) · 1.25 KB
/
docker-compose.yml
File metadata and controls
56 lines (52 loc) · 1.25 KB
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
version: '3.8'
services:
db:
image: postgres:15
restart: always
environment:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
POSTGRES_DB: exam_bud
ports:
- "5432:5432"
volumes:
- db-data:/var/lib/postgresql/data
backend:
build: ./backend
env_file: ./backend/.env
depends_on:
- db
ports:
- "4000:4000"
volumes:
- ./backend/uploads:/usr/src/app/uploads
test:
build: ./backend
environment:
DATABASE_URL: "postgresql://prisma:prisma@db:5432/exam_bud_test"
NODE_ENV: test
depends_on:
- db
working_dir: /usr/src/app
entrypoint: []
command: sh -c "
echo 'waiting for database...';
until nc -z db 5432; do sleep 1; done;
echo 'creating test database...';
PGPASSWORD=prisma psql -h db -U prisma -d exam_bud -c 'CREATE DATABASE exam_bud_test;' 2>/dev/null || echo 'Test database already exists';
echo 'regenerating prisma client';
npx prisma generate;
echo 'setting up database schema...';
npx prisma db push;
echo 'running tests...';
npm test"
profiles:
- test
frontend:
build: ./frontend
depends_on:
- backend
ports:
- "3001:3001"
volumes:
db-data: