-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
54 lines (50 loc) · 1.57 KB
/
Copy pathdocker-compose.yml
File metadata and controls
54 lines (50 loc) · 1.57 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
# This docker-compose.yml file defines three services: db, backend, and frontend. The db service uses the official PostgreSQL image and initializes the database with a provided SQL script. The backend service depends on the db service and is built from a Docker image that you have pushed to Docker Hub. The frontend service also depends on the backend and is built from another Docker image. Both services are configured to restart automatically and expose their respective ports.
# psql -U admin -d mydb
version: "3.9"
services:
db:
image: postgres:15
container_name: mydb
restart: always
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin123
POSTGRES_DB: mydb
ports:
- "5432:5432"
volumes:
- ./backend/db/init.sql:/docker-entrypoint-initdb.d/init.sql
- db_data:/var/lib/postgresql/data
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U admin"]
# interval: 5s
# retries: 5
backend:
image: alfinakash/fullstack-backend:latest
container_name: backend
restart: always
environment:
DB_HOST: db
DB_USER: admin
DB_PASSWORD: admin123
DB_NAME: mydb
DB_PORT: 5432
PORT: 5000
JWT_SECRET: your_jwt_secret_here
ports:
- "5000:5000"
# depends_on:
# db:
# condition: service_healthy
frontend:
image: alfinakash/fullstack-frontend:latest
container_name: frontend
restart: always
environment:
VITE_BACKEND_URL: http://localhost:5000
ports:
- "3000:3000"
depends_on:
- backend
volumes:
db_data: