forked from sunscrapers/fastapi-htmx-daisyui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
95 lines (87 loc) · 2.24 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
version: "3"
x-base-app-conf: &base_app_conf
env_file: .env
stdin_open: true
tty: true
services:
# Run FastAPI application
fasthtmx_app:
<<: *base_app_conf
image: fasthtmx_app:latest
container_name: fasthtmx_app
restart: always
build:
context: .
dockerfile: docker/Dockerfile
ports:
- "8000:8000"
volumes:
- "./app:/src/app"
# Generating CSS output file for Tailwind CSS on save
fasthtmx-npm-watch:
<<: *base_app_conf
image: fasthtmx_app:latest
container_name: fasthtmx-npm-watch
working_dir: /src
command: npm run watch:tailwindcss
restart: always
volumes:
- "./app:/src/app"
depends_on:
- fasthtmx_app
# Copying JS file from htmx package
fasthtmx-htmx-js-generator:
<<: *base_app_conf
image: fasthtmx_app:latest
container_name: fasthtmx-htmx-js-generator
working_dir: /src
command: npm run build:htmx
restart: no
volumes:
- "./app:/src/app"
depends_on:
- fasthtmx_app
# Apply migrations for database
fasthtmx_app_migrate:
<<: *base_app_conf
image: fasthtmx_app:latest
container_name: fasthtmx_app_migrate
command: bash -c """sleep 5 && alembic -c app/models/alembic.ini upgrade head"""
restart: no
build:
context: .
dockerfile: docker/Dockerfile
volumes:
- "./app:/src/app"
depends_on:
- db
# Locust tool for performance tests
perf_tests_full:
image: locustio/locust
ports:
- "8089:8089"
volumes:
- ./:/mnt/locust
command: -f /mnt/locust/performance_tests/locust_full_load_script.py -H http://fasthtmx_app:8000
perf_tests_partial:
image: locustio/locust
ports:
- "8090:8090"
volumes:
- ./:/mnt/locust
command: -f /mnt/locust/performance_tests/locust_partial_load_script.py -H http://fasthtmx_app:8000 --web-port 8090
db:
image: postgres:16.1-alpine
command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]
container_name: db
restart: always
environment:
- POSTGRES_DB=mydatabase
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
volumes:
- fastapi_db:/var/lib/postgresql/data
volumes:
fastapi_db: