Battery-Intelligence-Lab / galv

An open-source platform for automated storage of battery data with advanced metadata support
https://battery-intelligence-lab.github.io/galv/
Other
33 stars 8 forks source link

using a volume for frontend clobbers node_modules #47

Closed martinjrobins closed 1 year ago

martinjrobins commented 1 year ago

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

mjaquiery commented 1 year ago

@martinjrobins, please confirm this was closed by #50

martinjrobins commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

martinjrobins commented 1 year ago

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

mjaquiery commented 1 year ago

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.