Include Plugin modules in docker image #1458
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #1455 per discussion there.
First, I've updated the docker image to the latest python alpine image at the time, 3.8.1-alpine3.11. Not sure what kind of testing would be required to ensure this is working correctly, but with it I was able to build a site and run the built-in server via the container. I was also able to run the same "test" command used in your CI publish task. Not sure if there's any deeper testing you'd want to do there.
I added a pip install command to the existing run block for the two plugin modules that the theme supported. I could have added an additional RUN step instead of adding onto the existing one, I decided to add on since you'd already grouped it into one mega command instead of separating them.
I've also removed mkdocs-minify-plugin from requirements.txt, because it's not a requirement for the base module. The module itself is using requirements.txt, so this will change the dependencies of the installed module as well. You mentioned in the issue to add the install commands at the same place as the existing pip install, except there's no pip install in the current Dockerfile, the requirements are installed as part of running
setup.py install
.Finally, I added a .dockerignore file, based on this comment on a docker build issue. Without this, the docker engine reads every file in the directory to pass it to the build daemon, and there are thousands of node files that ultimately aren't used by docker, so this speeds up the build of the image significantly, at least on windows.
The image grew a bit, the current image is 117MB on my machine, whereas this one is 184 after building. The python base image grew from 79.1MB to 109MB as a result of the version change. The rest of the growth is from the
mkdocs_git_revision_date_localized_plugin
and it's dependencies, mostlybabel
which is 28.2MB on disk.Happy to make any revisions to this that you'd like.