You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm playing with Rocket framework and created a monorepository with dockerized server service. I'm using cargo-watch for development mode and it works fine if I launching it locally. After saving source files it recompiles after ~0.68 seconds. But when I start server service inside docker container it takes too long. Near 2 minutes to restart.
FROM rust:1.67
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN cargo install cargo-watch
COPY . .
As you can see, I've added src and target folder into the container volumes. I'm not sure if it's an issue with cargo-watch but it's really not obvious why it behaves like this. It looks like on each save it ignores cache and compiling from scratch. But container contains target folder. Does anyone know what's wrong there? Is this a cargo-watch issue?
Fairly easy to determine if it's a cargo-watch issue or not:
# build imagelocal> $ cd server; docker build -f Dockerfile.dev server
# start docker manually into a shelllocal> $ docker run -it --rm -v $(pwd)/server/src:/usr/src/app/src -v $(pwd)/server/target:/usr/src/app/target server bash
# do cargo run twice in the containercontainer> $ cargo run[Finished in X]container> $ cargo run[Finished in Y]
Hi! I'm playing with Rocket framework and created a monorepository with dockerized server service. I'm using cargo-watch for development mode and it works fine if I launching it locally. After saving source files it recompiles after ~0.68 seconds. But when I start server service inside docker container it takes too long. Near 2 minutes to restart.
This is my docker-compose.yml file:
docker-compose.dev.yml
And Dockerfile.dev:
As you can see, I've added src and target folder into the container volumes. I'm not sure if it's an issue with cargo-watch but it's really not obvious why it behaves like this. It looks like on each save it ignores cache and compiling from scratch. But container contains target folder. Does anyone know what's wrong there? Is this a cargo-watch issue?
You can find full repo here: https://github.com/zavvdev/rocket-svelte-rest/tree/main
Thanks!
The text was updated successfully, but these errors were encountered: