MedCATtrainer icon indicating copy to clipboard operation
MedCATtrainer copied to clipboard

Optimised multi-stage docker build for `cogstacksystems/medcat-trainer`

Open vvcb opened this issue 1 year ago • 1 comments

This is an optimised multi-stage docker build for cogstacksystems/medcat-trainer as described in detail in comments in response to #92.

  • Reduce uncompressed docker image size of cogstacksystems/medcat-trainer:v2.6.0 from 7.71GB to 6.13GB
    • Separate stage for building frontend saves ~450MB by only using the dist folder that is the output of npm build
    • Disable pip cache with pip install --no-cache-dir to save >900MB
    • Copy only required folders/files to save ~20MB
  • Create a non-root user to install dependencies and run container without elevated permissions
  • Fix path to manage.py in run.sh

Tested and working with docker-compose.yml with cogstacksystems/medcat-trainer-nginx:v2.6.0 and solr:8 (with default cdb.dat and vocab.dat).

vvcb avatar Mar 26 '23 22:03 vvcb

hi @vvcb - thanks for the contribution here. I tried building and running locally: $ docker compose -f docker-compose-dev.yml up

when I navigate to http://localhost:8001/ - the UI doesn't come up, /admin/ does appear though.

Also on the api container - can we still have vim installed?

I've found it handy in a pinch

tomolopolis avatar May 11 '23 16:05 tomolopolis