Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Plugin modules in docker image #1458

Merged
merged 2 commits into from Feb 14, 2020
Merged

Conversation

@FISHMANPET
Copy link
Contributor

FISHMANPET commented Feb 14, 2020

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, mostly babel which is 28.2MB on disk.

Happy to make any revisions to this that you'd like.

Copy link
Owner

squidfunk left a comment

That looks perfect! I’ll test it on macOS later and merge it afterwards. Also thanks for the great write up!

@squidfunk squidfunk merged commit d5adbe6 into squidfunk:master Feb 14, 2020
1 check passed
1 check passed
build
Details
@squidfunk

This comment has been minimized.

Copy link
Owner

squidfunk commented Feb 14, 2020

I tested your changes and everything seems to work. Just released 4.6.3. which also includes a new Docker image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.