Skip to content

Commit 2a4510e

Browse files
committed
🔧(docker) add a service in compose to frontend development
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.
1 parent d952815 commit 2a4510e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ run-backend: ## Start only the backend application and all needed services
128128
run: ## start the wsgi (production) and development server
129129
run:
130130
@$(MAKE) run-backend
131-
@$(COMPOSE) up --force-recreate -d frontend
131+
@$(COMPOSE) up --force-recreate -d frontend-development
132132
.PHONY: run
133133

134134
status: ## an alias for "docker compose ps"
@@ -315,7 +315,7 @@ frontend-lint: ## run the frontend linter
315315
.PHONY: frontend-lint
316316

317317
run-frontend-development: ## Run the frontend in development mode
318-
@$(COMPOSE) stop frontend
318+
@$(COMPOSE) stop frontend frontend-development
319319
cd $(PATH_FRONT_IMPRESS) && yarn dev
320320
.PHONY: run-frontend-development
321321

docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,23 @@ services:
157157
API_ORIGIN: "http://localhost:8071"
158158
PUBLISH_AS_MIT: "false"
159159
SW_DEACTIVATED: "true"
160+
image: impress:frontend-production
161+
ports:
162+
- "3000:3000"
163+
164+
frontend-development:
165+
user: "${DOCKER_USER:-1000}"
166+
build:
167+
context: .
168+
dockerfile: ./src/frontend/Dockerfile
169+
target: impress-dev
170+
args:
171+
API_ORIGIN: "http://localhost:8071"
172+
PUBLISH_AS_MIT: "false"
173+
SW_DEACTIVATED: "true"
160174
image: impress:frontend-development
175+
volumes:
176+
- ./src/frontend:/home/frontend
161177
ports:
162178
- "3000:3000"
163179

0 commit comments

Comments
 (0)