Dockerfile.dev
FROM rust:1.81.0-bullseye as builder
WORKDIR /app
RUN cargo install cargo-watch
RUN apt-get update && apt-get install -y libpq-dev && rm -rf /var/lib/apt/lists/*
COPY . .
docker-compose.dev.yml
version: '3.8'
services:
server:
build:
context: .
dockerfile: ./Dockerfile.dev
ports:
- 8080:8080
volumes:
- .:/app
depends_on:
db:
condition: service_healthy
command: cargo watch -x run
stdin_open: true
tty: true
db:
image: postgres:16
restart: always
user: postgres
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data:
the server and databse are working but when i change the code the watch is not working