Skip to content

Commit

Permalink
Add watch command to rebuild app upon file changes (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke-Rogerson authored Oct 20, 2023
1 parent 0517ca0 commit 9b60e45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ stop:
@echo "Stopping server and db..."
@docker-compose down

watch: start
@echo "Watching for file changes..."
@docker-compose watch

restart: stop start

logs:
Expand Down
12 changes: 9 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
version: "3.8"
services:
app:
server:
build:
dockerfile: Dockerfile
context: .
ports:
- "80:8080"
volumes:
- .:/app
environment:
- REDIS_ADDRESS=db:6379
- REDIS_PASSWORD=secret
- REDIS_DB=0
depends_on:
- db
develop:
watch:
- action: rebuild
files:
- ./**/*.go
- ./go.mod
- ./go.sum

db:
image: redis:7.2.1-alpine
restart: always
Expand Down

0 comments on commit 9b60e45

Please sign in to comment.