-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.local.yml
More file actions
54 lines (51 loc) · 2.01 KB
/
Copy pathdocker-compose.local.yml
File metadata and controls
54 lines (51 loc) · 2.01 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 file is optimized for local development.
# It builds the image locally and mounts your source code for live changes.
services:
# The PostgreSQL Database Service for development
db:
image: postgres:17-alpine
container_name: local_dev_db
restart: unless-stopped
environment:
# Use non-production credentials for local development
- POSTGRES_USER=dev_user
- POSTGRES_PASSWORD=dev_password
- POSTGRES_DB=bankdb_dev
volumes:
# Persists database data in a named volume to survive restarts
- postgres_dev_data:/var/lib/postgresql/data
ports:
# Map to host port 5433 to avoid conflicts with any other local PostgreSQL instance
- "5433:5432"
# The Rust API Service for development
api:
container_name: local_dev_api
# This tells docker-compose to build the image from the Dockerfile
# in the current directory.
build: .
volumes:
# Mount the entire project directory into the container.
# This is the key for live development: code changes on your host machine
# are instantly reflected inside the container. Cargo will use this source
# to recompile just what's necessary.
- .:/app
working_dir: /app
# Override the production CMD from the Dockerfile.
# This keeps the container running indefinitely so you can attach a shell
# or run commands inside it as needed.
command: sleep infinity
ports:
- "3000:3000"
environment:
# The DATABASE_URL is used by both sqlx-cli and the app itself.
# The APP_* variables are used by the config crate at runtime.
- DATABASE_URL=postgres://dev_user:dev_password@db:5432/bankdb_dev
- APP_DATABASE_URL=postgres://dev_user:dev_password@db:5432/bankdb_dev
- APP_JWT__SECRET=a-simple-and-insecure-local-dev-secret
# Use a more verbose log level for local development.
- RUST_LOG=info,sqlx=warn
depends_on:
- db
# Defines the named volume for the development database
volumes:
postgres_dev_data: