forked from 3mard/cloud-pricing-api
-
Notifications
You must be signed in to change notification settings - Fork 12
/
docker-compose.yml
84 lines (78 loc) · 2.29 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
version: '3.4'
services:
api:
build:
context: .
dockerfile: Dockerfile
image: infracost/cloud-pricing-api:latest # Latest stable release
ports:
- 4000:4000
environment:
- INFRACOST_API_KEY=${INFRACOST_API_KEY}
- SELF_HOSTED_INFRACOST_API_KEY=${SELF_HOSTED_INFRACOST_API_KEY}
- POSTGRES_HOST=postgres
- POSTGRES_DB=cloud_pricing
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4000/health"]
interval: 60s
timeout: 10s
retries: 3
start_period: 10s
depends_on: [postgres]
networks:
- cloud_pricing_api
init_job:
build:
context: .
dockerfile: Dockerfile
image: infracost/cloud-pricing-api:latest # Latest stable release
environment:
- INFRACOST_API_KEY=${INFRACOST_API_KEY}
- POSTGRES_HOST=postgres
- POSTGRES_DB=cloud_pricing
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
depends_on: [postgres]
networks:
- cloud_pricing_api
command: ["npm", "run", "job:init"]
# Cron: Add a cron job to run every week to update the database data. The cron entry should look something like:
# 0 4 * * SUN docker-compose run --rm update_job npm run job:update >> /var/log/cron.log 2>&1
update_job:
build:
context: .
dockerfile: Dockerfile
image: infracost/cloud-pricing-api:latest # Latest stable release
environment:
- INFRACOST_API_KEY=${INFRACOST_API_KEY}
- POSTGRES_HOST=postgres
- POSTGRES_DB=cloud_pricing
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
depends_on: [postgres]
networks:
- cloud_pricing_api
command: ["npm", "run", "job:update"]
postgres:
image: postgres:13
user: postgres
environment:
- POSTGRES_DB=cloud_pricing
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 60s
timeout: 10s
retries: 3
start_period: 10s
volumes:
- postgres-data:/var/lib/postgresql/data/
networks:
- cloud_pricing_api
volumes:
postgres-data:
networks:
cloud_pricing_api: