Skip to content

Conversation

@leej3
Copy link

@leej3 leej3 commented Sep 20, 2024

Add fixes for docker compose deployment

Resolves #1010

Description

Improve docker-compose set up.

Solution

  • Backend and frontend images are built with their own Dockerfiles: This captures as much of the installation/set up as possible during the build stage. This should speed up development as only changes to dependencies should necessitate reinstalling the npm deps. As an alternative the docker-compose watch functionality can sync the required
  • Ignore rather than bind mount node_modules into the docker image: The node_modules should be for the local host if such an installation exists. In the docker image these directories will be specific to that environment. Updating these requires an image rebuild
  • Note that this deployment will work on apple silicon too; however, DOCKER_DEFAULT_PLATFORM must be set to "linux/amd64". PhantomJS is not distributed for linux arm64 so a container running on the native chip architecture doesn't work.

Remaining (potential) issues

  • I have changed the hosts to db/db_test, which is available in the docker network (network mode of "host" only works on linux). I'm not sure this is the best location to change this and what API_HOST should be set to. The deployment seems to be working for me as far as I can tell though.
  • Currently some files are invalidating the docker build cache which slows down development. Hopefully the culprits can be found and then running docker compose up --build will only trigger a rerun of npm install if the appropriate files have changed
  • Currently the test compose file is failing. Something is misconfigured and the migration fails. I can't spot what it is though. It might be better to use the same images/configuration for the tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant