Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add watch command to rebuild app upon file changes #11

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading