-
Notifications
You must be signed in to change notification settings - Fork 223
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
obs-443: switch to docker compose watch #6873
base: main
Are you sure you want to change the base?
Conversation
Currently for the local dev environment, we volume mount the local directory as `/app` which causes anything built during docker image build to be shadowed by the user's local directory. We get around this by having docker image build any artifacts into directories in the image that are not under `/app`. This is a little wonky and there are hacks strewn about to alleviate the consequences. Instead of doing that, this PR is an initial pass and switching to docker compose watch. In this new model, we no longer volume mount the local directory as `/app` and instead docker compose watches for changes on the local file system and syncs them with the container and will run any rebuilding scripts. This should work with the local dev environment, CI, and server environments. This requires v2.22.0 of docker compose plugin. This doesn't update documentation and doesn't document edge cases to be aware of.
@toufali This is the PR with the docker compose watch stuff in it. If we're going to go this route, it'll be easier to land this before landing your next set of changes. Do you want to look at this and see if you can finish it up? |
watch: | ||
- action: sync | ||
path: . | ||
target: /app |
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.
This includes the sync action which will copy files from the host to the container.
There's also a rebuild action which I think we want to use to run manage.py collectstatic and esbuild when js and css files change.
We only need this rebuild on the webapp service because that's the only one using js and css files.
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.
Yes! Thanks for posting, I'll work on this. See also my questions above that I'm happy to add if you agree. |
@willkg I've spent a bit of time testing this – using Compose Watch accomplishes the goal of not overwriting files in the app folder, as discussed. However, I am not seeing the "sync" behavior as expected. Would love to pair on this when you're able! |
Currently for the local dev environment, we volume mount the local directory as
/app
which causes anything built during docker image build to be shadowed by the user's local directory. We get around this by having docker image build any artifacts into directories in the image that are not under/app
. This is a little wonky and there are hacks strewn about to alleviate the consequences.Instead of doing that, this PR is an initial pass and switching to docker compose watch. In this new model, we no longer volume mount the local directory as
/app
and instead docker compose watches for changes on the local file system and syncs them with the container and will run any rebuilding scripts.This should work with the local dev environment, CI, and server environments.
This requires v2.22.0 of docker compose plugin.
This doesn't update documentation and doesn't document edge cases to be aware of.
Current problems:
just run
should always build first, then run? Is that too onerous?just shell
and other just rules?docker-compose.yaml
that needs it. It's not sufficient to do it for theapp
image. I think I got them all, but maybe I missed something.develop
key. Does CI have the right version?To do:
just run
to always build first/app
in a default place./manage.py collectstatic
afterjust testshell
and before running tests anymore/app
in a default placejust build
again?