-
Notifications
You must be signed in to change notification settings - Fork 333
🔧(docker) add a service in compose to frontend development #1033
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
base: main
Are you sure you want to change the base?
Conversation
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.
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, can you amend the build-frontend
make target, too, so that it builds both services?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the port 3000 is available, so starting both containers will cause problems.
image: impress:frontend-development | ||
volumes: | ||
- ./src/frontend:/home/frontend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is lot of side effects by keeping the node_modules
sync, I think it is common pattern to exclude it:
- ./src/frontend:/home/frontend | |
- ./src/frontend:/home/frontend | |
- /home/frontend/node_modules | |
- /home/frontend/apps/impress/node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new Docker Compose service for frontend development to enable hot reload by mounting local sources, and updates Makefile targets to use that service.
- Introduces
frontend-development
service in docker-compose with build args, volume mount, and port mapping - Updates Makefile
run
alias to start the dev service instead of production frontend, and adjustsrun-frontend-development
to stop containers before launching
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
docker-compose.yml | Expose production frontend image/ports and add frontend-development service with build, volume, ports |
Makefile | Change run to bring up frontend-development and update run-frontend-development stop logic |
Comments suppressed due to low confidence (2)
docker-compose.yml:174
- The
image
key forfrontend-development
is indented with 6 spaces, but service-level keys should use 4 spaces. This misalignment can cause a YAML parse error.
image: impress:frontend-development
Makefile:319
- The
run-frontend-development
target stops both services but never starts thefrontend-development
container. To leverage the new Compose service for hot reload, add@$(COMPOSE) up --force-recreate -d frontend-development
before runningyarn dev
.
cd $(PATH_FRONT_IMPRESS) && yarn dev
Purpose
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.
Proposal