Skip to content

Commit

Permalink
Closes #67
Browse files Browse the repository at this point in the history
Add docker compose profile feature to turn on/off the hot-reload.
  • Loading branch information
Sojusan committed Sep 22, 2024
1 parent abc35dc commit 15a69b8
Show file tree
Hide file tree
Showing 4 changed files with 12,325 additions and 17,326 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dotnet dev-certs https -ep .aspnet/https/aspnetapp.pfx -p devcertpasswd --trust
```

Next go to the `scripts` directory and run `apply_migrations.ps1`
Next You should go back to the main directory and run `docker compose up --build --watch`
Next You should go back to the main directory and run `docker compose --profile hot-reload up --build --watch`
This can be done with the following snippet.

```powershell
Expand All @@ -53,7 +53,13 @@ Directory `scripts` contains some helpful scripts which automate some parts of w
The application is started using the following command:

```bash
docker compose up --build --watch
docker compose --profile hot-reload up --build --watch
```

or without the hot-reload feature:

```bash
docker compose --profile without-hot-reload up --build --watch
```

The `--watch` parameter starts containers with the `hot-reload` feature. This enables the auto-reload functionality, meaning that the container will be automatically reloaded when the code for either the frontend or backend changes.
Expand Down
26 changes: 22 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
services:
frontend:
frontend: &frontend-base
container_name: ks-frontend
profiles:
- without-hot-reload
build:
context: ./frontend
command: ["npm", "run", "dev"]
ports:
- "8888:8888"

frontend-hot-reload:
<<: *frontend-base
container_name: ks-frontend-hot-reload
profiles:
- hot-reload
command: ["npm", "run", "dev"]
develop:
watch:
- action: sync
Expand All @@ -16,11 +24,12 @@ services:
- action: rebuild
path: package.json

backend:
backend: &backend-base
container_name: ks-backend
build:
context: ./backend
target: development
profiles:
- without-hot-reload
ports:
- "5001:80"
- "5000:443"
Expand All @@ -36,6 +45,15 @@ services:
depends_on:
db:
condition: service_healthy

backend-hot-reload:
<<: *backend-base
container_name: ks-backend-hot-reload
build:
context: ./backend
target: development
profiles:
- hot-reload
develop:
watch:
- action: sync
Expand Down
Loading

0 comments on commit 15a69b8

Please sign in to comment.