From e3151ed6c97d4757cd62713e10be86f818a39c6d Mon Sep 17 00:00:00 2001 From: Cristian Oliveira Date: Sat, 2 Sep 2023 12:58:17 +0200 Subject: [PATCH] chore: adds live reload services --- .watch.yaml | 12 +++++++++--- Dockerfile | 2 +- Makefile | 14 ++++++++++++-- docker-compose.yml | 8 +++++++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.watch.yaml b/.watch.yaml index 9a32014..f16dd18 100644 --- a/.watch.yaml +++ b/.watch.yaml @@ -3,10 +3,16 @@ # # list here all the events and the commands that it should execute +- name: restart main app + run: 'docker compose restart web' + change: ['app/**/*', 'nginx/default.conf', 'docker-compose.yml'] + ignore: ['services/**/*'] + - name: restart todos-app run: 'docker compose restart todos-app' change: 'services/todos/**/*' -# - name: restart todos-app -# run: 'docker compose restart todos-app' -# change: 'services/two/**/*' +- name: restart chat-app + run: 'docker-compose up --detach --build' + change: 'services/chat/**/*' + ignore: [ 'services/chat/target/**/*' ] diff --git a/Dockerfile b/Dockerfile index 212f3e4..4d13aa7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM nginx -# COPY app /usr/share/nginx/html +COPY ./nginx /etc/nginx/conf.d/ diff --git a/Makefile b/Makefile index 5b4f01e..f963e06 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,22 @@ start: @echo "Starting the services..." @docker compose up +.phony: rebuild-start +rebuild-start: + @echo "rebuilding the services..." + @docker compose up --build + .Phony: build build: - @echo "Starting the services..." + @echo "Building the services..." @docker compose build .PHONY: watch watch: @echo "Watching the application..." - @funzzy + @funzzy --config=.watch.yaml + +.PHONY: kill +kill: + @echo "Killing all applications..." + @docker compose kill diff --git a/docker-compose.yml b/docker-compose.yml index f7b8bd1..cd72d23 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ services: volumes: - ./app:/usr/share/nginx/html - - ./nginx:/etc/nginx/conf.d/ todos-app: build: services/todos @@ -14,3 +13,10 @@ services: - "4001:4001" # Web Server volumes: - ./services/todos:/app + + chat-app: + build: services/chat + ports: + - "4002:4002" # Web Server + # volumes: + # - ./services/chat:/app