-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
71 lines (66 loc) · 2.2 KB
/
Copy pathdocker-compose.yml
File metadata and controls
71 lines (66 loc) · 2.2 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
version: "3.8"
# Define the services/containers
###############################################################################################
# The docker-compose.yml file sets up a multi-container Docker application #
# with four services: PostgreSQL, MongoDB, Backend API, and Frontend React App. #
# Each service is defined with its image, environment variables, ports, volumes, #
# and dependencies to ensure proper startup order. #
# #
# Docker Compose is a tool for defining and running multi-container Docker applications. #
# With Compose, you use a YAML file to configure your application’s services. #
# Then, with a single command, you create and start all the services from your configuration. #
###############################################################################################
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: demo-postgres
environment:
POSTGRES_USER: demouser
POSTGRES_PASSWORD: demopass
POSTGRES_DB: demodb
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U demouser"]
interval: 10s
timeout: 5s
retries: 5
# Backend API
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: demo-backend
environment:
PORT: 8081
DATABASE_URL: postgres://demouser:demopass@postgres:5432/demodb
GEMINI_API_KEY: key
ports:
- "8081:8081"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./backend:/app
- /app/node_modules
# Frontend React App
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: demo-frontend
environment:
REACT_APP_API_URL: http://localhost:8081
ports:
- "8080:5173"
depends_on:
- backend
volumes:
- /app/node_modules
stdin_open: true
tty: true
volumes:
postgres-data: