Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

using a volume for frontend clobbers node_modules #47

Closed
martinjrobins opened this issue Feb 26, 2023 · 7 comments
Closed

using a volume for frontend clobbers node_modules #47

martinjrobins opened this issue Feb 26, 2023 · 7 comments
Labels
bug Something isn't working v2.0.0 Required for v2.0.0

Comments

@martinjrobins
Copy link
Collaborator

The frontend service maps the frontend host dir to the app dir in the container

 volumes:
     - ./frontend:/app

however, this means that the yarn install in the Dockerfile has no effect, you need to run yarn install on the host for this to work

@martinjrobins martinjrobins added bug Something isn't working v2.0.0 Required for v2.0.0 labels Feb 26, 2023
@mjaquiery mjaquiery mentioned this issue Feb 27, 2023
mjaquiery added a commit that referenced this issue Feb 27, 2023
- closes #48 - fixed incorrect API call endpoint
- closes #47 - added volume override for `/app/node_modules/`
- closes #49 - use `.env.secret` in tests; create `.env.secret` in GitHub tests from envvars
@mjaquiery
Copy link
Collaborator

@martinjrobins, please confirm this was closed by #50

@martinjrobins
Copy link
Collaborator Author

nope, now get this error when I docker-compose up --build

 ⠙ Container galvanalyser-frontend-1   Creating
Error response from daemon: fill out specgen: must set source volume

@mjaquiery
Copy link
Collaborator

Ah, we probably need to set it up like this, instead, then:
- frontend_node_modules:/app/node_modules/
Then at the bottom:

volumes:
  frontend_node_modules:

If that works, can you push to v2.0.0, please?

@martinjrobins
Copy link
Collaborator Author

no, get another error:
Error response from daemon: fill out specgen: /app/node_modules: duplicate mount destination

Perhaps this is all version 3 stuff? (we are using version 2)

@martinjrobins
Copy link
Collaborator Author

or perhaps this is podman issues (I'm using podman, not docker)

@martinjrobins
Copy link
Collaborator Author

could be that I'm using an older version of podman (containers/podman#11822) that has limited volume support. So I think it is my setup that is the issue :(

@mjaquiery
Copy link
Collaborator

Our alternative plan here is to move the yarn install into the up command, and leave the mounting as simply mounting the whole frontend directory.

We figured the overheads aren't huge, and keeping node_modules directory accessible to the host system means that IDEs have an easier time doing deep code comprehension.

@martinjrobins are you happy to set it up with yarn install in CMD/launch script? I guess we need to move the bottom bit of the Dockerfile[_dev] out into a shell script and set an envvar to determine which path to go down. On the bright side, we can drop Dockerfile_dev.

martinjrobins added a commit that referenced this issue Mar 1, 2023
#47 frontend-dev runs yarn install on docker-compose up
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working v2.0.0 Required for v2.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants