Allow selecting installed optional dependencies in Docker build#548
Allow selecting installed optional dependencies in Docker build#548juhoinkinen merged 2 commits intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #548 +/- ##
=======================================
Coverage 99.49% 99.49%
=======================================
Files 80 80
Lines 5313 5313
=======================================
Hits 5286 5286
Misses 27 27 Continue to review full report at Codecov.
|
|
What about fasttext? It will be installed regardless of this setting, right? |
Yes, that's true, I thought it would not be installed... Or at least not available right away. Hmm, I don't if its copying from builder stage can be controlled this way conveniently enough. |
|
I don't think always including fasttext is a very big deal, this PR is still a big improvement. That said, I think it could be possible to avoid installing fasttext by making the if [[ $optional_dependencies =~ "fasttext" ]]; then pip install --no-cache-dir fasttext==0.9.2; fi(perhaps the The ARG declaration needs to be moved earlier of course. The COPY command would then copy an empty /usr/local/lib/python3.8 directory from the builder image. |
|
Kudos, SonarCloud Quality Gate passed! |
|
I added a section of customizing Docker image to Wiki: https://github.com/NatLibFi/Annif/wiki/Usage-with-Docker#customizing-docker-image |








Currently we provide a Dockerfile and an image in quay.io with dependencies for all the optional features.
If someone does not need all the features, but e.g. uses only Omikuji backend and would like build their own image (e.g. for smaller size), they could edit the Dockerfile dropping the unwanted (Python) dependencies from the pip install command. However, using
--build-argoption ofdocker buildprovides a way to pass the user-defined list of dependencies to install that overrides the default list:A user wanting to have a Docker image to use with Xtransfomer could add
pecosto the default list in build time.