Skip to content

Commit

Permalink
docker: ensure the server can see the .hotfile from the new frontend
Browse files Browse the repository at this point in the history
The `.hotfile` is used by Vite to store some information about
Hot-Module Replacement (HMR) and also by the django-vite-plugin to
figure out whether Vite is running[1]; this creates a filesystem
dependency where 2024-frontend has to write the hotfile and the server
has to read it. But now that we git-ignore[2] the hotfile (which is a
good idea) the server couldn't see the file anymore.

Before:

1. We built the server Docker image with all the files in it;
2. We built the 2024-frontend image based on it;
3. It had a (stale) `.hotfile` included because we tracked it.

After the ignore:

1. We built the server Docker images without the hotfile ;
2. We built the 2024-frontend image based on it;
3. The hotfile was not present because 2024-frontend writes it to
`../app` but since we only mounted `2024-frontend` into
`/app/2024-frontend` the parent folder is not shared: no hotfile,
everybody gets sad.

Now:

1. We share the whole current folder into `.:/app`, which means the
2024-frontend writes the hotfile up into `../` and the server sees it;
2. Things work as expected.

[1]: https://github.com/protibimbok/django-vite-plugin/blob/master/django/src/django_vite_plugin/utils.py#L120-L124
[2]: 0687770
  • Loading branch information
freesteph committed Jan 13, 2025
1 parent 1ff8fa0 commit 47b8dec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
context: 2024-frontend
image: ma-cantine-2024-front
volumes:
- "./2024-frontend:/app/2024-frontend"
- "./:/app"
- "/app/2024-frontend/node_modules"
ports:
- 5173:5173
Expand Down

0 comments on commit 47b8dec

Please sign in to comment.