#cargo watch -x run is not working inside docker

1 messages · Page 1 of 1 (latest)

vital stump
#

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

edgy trellis
vital stump
#

I'm on windows btw

edgy trellis
#

Is the guest also Windows?

vital stump
#

@frosty raptor check here

edgy trellis
frosty raptor
#

I know the solution on Linux, can't help on windows

vital stump