You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: frontend/README.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,35 @@ From the `npd` project root:
34
34
35
35
1. Ensure that a suitable docker service is running
36
36
1. Run `docker compose up --build` to launch the backend and frontend applications
37
+
- If you want to run the application backend and frontend separately, you can do that with:
38
+
```console
39
+
~/npd $ docker compose up -d django-web
40
+
~/npd $ docker compose up -d web
41
+
```
42
+
1. Happy coding!
37
43
38
-
- If you want to run the application backend and frontend separately, you can do that with:
39
-
```console
40
-
~/npd $ docker compose up -d django-web
41
-
~/npd $ docker compose up -d web
42
-
```
44
+
### Adding Dependencies
43
45
44
-
1. Happy coding!
46
+
Because of our current frontend docker compose setup, new dependencies **MUST** be installed with `docker compose run web npm install`. They will not be picked up by `docker compose build web` or `docker compose up --build web`.
47
+
48
+
The reason is that we are mounting a virtual docker compose volume in place of the container's `/app/node_modules` directory, but `docker compose build` doesn't know about _runtime_ volume mounts, only _host_ and _base image_ mounts, so it cannot update the docker compose virtual volume, only the directory which is present inside the image during the build process.
49
+
50
+
For us, this means that if you are running in docker containers with `docker compose` and want to add a frontend dependency, you'll need to make sure they are added inside the running container with `docker compose run npm install`, as well as outside (on your host machine) if you need that for editor support or to run `npm` commands on host.
51
+
52
+
```sh
53
+
# install and save a new dependency on host, to make the editor tooling happy
54
+
cd frontend
55
+
npm install --save i18next
56
+
57
+
# in docker, to make the image happy
58
+
docker compose run --rm web npm install
59
+
```
60
+
61
+
Likewise, if `package.json` has been updated since you last fetched project updates, you'll need to run:
62
+
63
+
```sh
64
+
# after `git pull` when frontend/package.json has been updated
65
+
docker compse run --rm web npm install
66
+
```
67
+
68
+
to refresh your local frontend docker compose `web` service.
0 commit comments