From f07fcd4c0dc72e54315e2320a16476955728083c Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Jun 2025 19:00:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(docker)=20add=20a=20service=20in?= =?UTF-8?q?=20compose=20to=20frontend=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want a serice in compose starting the frontend application in development mode. We want to take the advantage of the hot reload module, so the sources are mounted inside the container. --- Makefile | 6 +++--- docker-compose.yml | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ea5fdbc5..d917b391 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,7 @@ build-yjs-provider: ## build the y-provider container build-frontend: cache ?= build-frontend: ## build the frontend container - @$(COMPOSE) build frontend $(cache) + @$(COMPOSE) build frontend-development $(cache) .PHONY: build-frontend down: ## stop and remove containers, networks, images, and volumes @@ -128,7 +128,7 @@ run-backend: ## Start only the backend application and all needed services run: ## start the wsgi (production) and development server run: @$(MAKE) run-backend - @$(COMPOSE) up --force-recreate -d frontend + @$(COMPOSE) up --force-recreate -d frontend-development .PHONY: run status: ## an alias for "docker compose ps" @@ -315,7 +315,7 @@ frontend-lint: ## run the frontend linter .PHONY: frontend-lint run-frontend-development: ## Run the frontend in development mode - @$(COMPOSE) stop frontend + @$(COMPOSE) stop frontend frontend-development cd $(PATH_FRONT_IMPRESS) && yarn dev .PHONY: run-frontend-development diff --git a/docker-compose.yml b/docker-compose.yml index fefbd880..f9025850 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -147,17 +147,21 @@ services: condition: service_healthy restart: true - frontend: + frontend-development: user: "${DOCKER_USER:-1000}" build: context: . dockerfile: ./src/frontend/Dockerfile - target: frontend-production + target: impress-dev args: API_ORIGIN: "http://localhost:8071" PUBLISH_AS_MIT: "false" SW_DEACTIVATED: "true" image: impress:frontend-development + volumes: + - ./src/frontend:/home/frontend + - /home/frontend/node_modules + - /home/frontend/apps/impress/node_modules ports: - "3000:3000"