Scenario: A developer working on the genai-stack project wants to enable automatic rebuilds whenever they make changes to the codebase. They can achieve this by using watch mode when building the stack.
Codebase Files and Directories:
- embedding_model/
- front-end/
- public/
- vite.svg
- src/
- assets/
- lib/
- App.svelte
- app.css
- main.js
- vite-env.d.ts
- index.html
- jsconfig.json
- package-lock.json
- package.json
- postcss.config.js
- svelte.config.js
- tailwind.config.js
- vite.config.js
- images/
- datamodel.png
- CONTRIBUTING.md
- LICENSE
- api.Dockerfile
- api.py
- bot.Dockerfile
- bot.py
- chains.py
- docker-compose.yml
- env.example
- front-end.Dockerfile
- install_ollama.sh
- loader.Dockerfile
- loader.py
- pdf_bot.Dockerfile
- pdf_bot.py
- pull_model.Dockerfile
- readme.md
- requirements.txt
- running_on_wsl.md
- utils.py
Documentation:
To enable watch mode for automatic rebuilds in the genai-stack project, follow these steps:
Open the terminal and navigate to the root directory of the project (genai-stack).
Build the stack using Docker Compose with the
--build-arg WATCH_MODE=true
flag:
docker-compose up --build --build-arg WATCH_MODE=true
This flag enables watch mode for all services in the docker-compose.yml file.
- Now, whenever you make changes to any file in the project, the corresponding service will be automatically rebuilt.
Tests:
To verify that watch mode is working correctly, make a change to one of the files (e.g., update the text in App.svelte), save the file, and observe the output in the terminal. You should see a message indicating that the service is being rebuilt.
Additionally, you can check the running containers by using the following command:
docker ps
You should see the container for the affected service being restarted.
References:
- Docker Compose File
- Docker Compose Watch Mode
- Kubernetes Watch
- Terraform CDK Watch
- Docker Compose: Experiment - Sync Files and Automatically Rebuild Services with Watch Mode
- Linux Watch Command
- etcd Watch Historical Changes of Keys
- Kubernetes Watch
- Hashicorp Consul Watches
- How to Keep the Death Star Terraform Enterprise Safe and Performant
- Throughput Autoscaling at Facebook
Videos:
- Tutorial: Building an Enterprise Infrastructure Control Plane on Kubernetes
- Docker Community All-Hands #2
- Docker Tutorial for Beginners | Docker Full Course | Access to FREE LABS [No Ads]
- Learn how to move your existing Java app to Kubernetes—without changing a single line of code
- A Hard Multi-tenancy ## Solution: Use Case, Challenges and Work
- Build cross-platform interactive polls with .NET and MQTT (BOA319)
- CNCF SIG Runtime 2020-02-20
- Tutorial: KubeEdge Hands on Workshop – Build Your Edge AI App on Real Edge Devices
- AWS re:Invent 2022 - Best practices for advanced serverless developers (SVS401)
- Simplify All the Things with Docker Compose
- Breaking Tradition: The future of package management with Kubernetes
- AWS re:Invent 2022 - Camada Zero: A real-world architecture framework (PRT268)
- Jim Whitehurst at Red Hat Summit 2017: Impact of the individual
- Day 2 Operations with Windows Containers