-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
41 lines (39 loc) · 1.52 KB
/
Copy pathdocker-compose.yml
File metadata and controls
41 lines (39 loc) · 1.52 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
services:
# The PostgreSQL Database Service for production
db:
image: postgres:17-alpine
container_name: production_db
restart: unless-stopped
environment:
# --- IMPORTANT: You can change these credentials for your deployment ---
- POSTGRES_USER=prod_user
- POSTGRES_PASSWORD=a_very_strong_password
- POSTGRES_DB=bankdb_prod
volumes:
# This persists the database data on your local machine.
- postgres_prod_data:/var/lib/postgresql/data
ports:
# Optionally expose the database port to the host machine for debugging.
- "5432:5432"
# The Rust API Service, pulled from Docker Hub
api:
# This pulls your public image from Docker Hub.
image: annondeveloper/tiny-bank-server:main
container_name: production_api
restart: unless-stopped
ports:
# Map port 3000 on your local machine to port 3000 in the container.
- "3000:3000"
environment:
# These environment variables configure the running application.
# The password here MUST match the POSTGRES_PASSWORD set for the 'db' service above.
- APP_DATABASE_URL=postgres://prod_user:a_very_strong_password@db:5432/bankdb_prod
# --- IMPORTANT: Change this to a secure, random string for production ---
- APP_JWT_SECRET=your_super_secret_production_key_12345
- RUST_LOG=info
# This ensures the database container is started before the API starts.
depends_on:
- db
# Defines the named volume for persisting database data.
volumes:
postgres_prod_data: