aboutcode-org / aboutcode-org/vulnerablecode

Enable Hot Reloading in Docker Container

Đang mở
#1,771 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
702
Fork
328
Merge trung bình
3 ngày 8 giờ
Pull request đã merge (30 ngày)
3

Mô tả

"_Hot Reloading Not Working in Docker Container_" Live code updates inside the Docker container are not taking effect as expected. Currently, hot reloading requires a full container rebuild using ` docker compose up --build ` for changes to be reflected, which slows down the development process.

### Solution: How to Enable Hot Reloading?

1. Use Bind Mounts Modify docker-compose.yml to mount the code into the container:

```
services:
vulnerablecode:
volumes:
- .:/app # Syncs local changes with the container
```

2. Enable Gunicorn Auto-Reload Update the Gunicorn command to include the `--reload ` flag , allowing automatic reloading when code changes:

```
command:
gunicorn --reload vulnerablecode.wsgi:application -b :8000 --timeout 600 --workers 8
```
This setup allows the dockerized application to reflect the changes automatically when code changes are detected.

**How to Test ?**
> 1.Modify the code (Python files or static UI elements).
> 2. Check the container logs for updates:
``` sh docker compose logs -f vulnerablecode ```
> 3. Refresh the UI in the browser.
> 4. Verify the changes without rebuilding the container.

**Expected Outcome:**

- Code modifications should trigger an automatic reload inside the container.
- No need to manually rebuild the container after every change.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.