-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
141 lines (133 loc) · 3.79 KB
/
docker-compose.yaml
File metadata and controls
141 lines (133 loc) · 3.79 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
services:
db:
container_name: gitassets_postgres_db
image: bitnami/postgresql:latest
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "5435:5432"
volumes:
- db-data:/bitnami/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- gitassets-network
base:
container_name: gitassets_base
image: gitassets-base
build:
context: .
dockerfile: Dockerfile.base
command: ["echo", "Base image built successfully."]
networks:
- gitassets-network
migrator:
container_name: gitassets_migrator
build:
context: .
dockerfile: ./database/Dockerfile
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
depends_on:
db:
condition: service_healthy
base:
condition: service_completed_successfully
networks:
- gitassets-network
web:
container_name: gitassets_web
build:
context: .
dockerfile: ./web/Dockerfile
restart: unless-stopped
env_file:
- ./web/.env
environment:
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
- API_URL=http://api:3435 # Internal network URL
- NEXTAUTH_URL=${NEXTAUTH_URL}
- NEXTAUTH_SECRET=${JWT_SECRET} # Using same secret for simplicity or add specific env
depends_on:
migrator:
condition: service_completed_successfully
db:
condition: service_healthy
base:
condition: service_completed_successfully
# ports:
# - "3000:3000" # Exposed via Nginx
networks:
- gitassets-network
api:
container_name: gitassets_api
build:
context: .
dockerfile: ./api/Dockerfile
restart: unless-stopped
env_file:
- ./api/.env
environment:
- NODE_ENV=${NODE_ENV:-production}
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- JWT_SECRET=${JWT_SECRET}
- PORT=${PORT}
- MERCADO_PAGO_ACCESS_TOKEN=${MERCADO_PAGO_ACCESS_TOKEN}
- MERCADO_PAGO_WEBHOOK_URL=${MERCADO_PAGO_WEBHOOK_URL}
- MERCADO_PAGO_WEBHOOK_SECRET=${MERCADO_PAGO_WEBHOOK_SECRET}
- CORS_ORIGIN=${CORS_ORIGIN}
depends_on:
migrator:
condition: service_completed_successfully
db:
condition: service_healthy
base:
condition: service_completed_successfully
# ports:
# - "3333:3435" # Exposed via Nginx
networks:
- gitassets-network
nginx:
container_name: gitassets_nginx
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./config/nginx/nginx.conf.template:/etc/nginx/templates/nginx.conf.template
- ./config/certbot/conf:/etc/letsencrypt
- ./config/certbot/www:/var/www/certbot
# - ./config/nginx/nginx.conf.template.local:/etc/nginx/templates/nginx.conf.template
env_file:
- ./config/nginx/domains.env
networks:
- gitassets-network
depends_on:
base:
condition: service_completed_successfully
api:
condition: service_started
web:
condition: service_started
command: >
/bin/sh -c "envsubst '$$GITASSETS_API_DOMAIN $$GITASSETS_WEB_DOMAIN' < /etc/nginx/templates/nginx.conf.template > /etc/nginx/conf.d/default.conf
&& nginx -g 'daemon off;'"
restart: unless-stopped
certbot:
container_name: gitassets_certbot
image: certbot/certbot
volumes:
- ./config/certbot/conf:/etc/letsencrypt
- ./config/certbot/www:/var/www/certbot
volumes:
db-data:
driver: local
networks:
gitassets-network:
driver: bridge