question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide an official docker container with a production server

See original GitHub issue

I checked that…

  • … the documentation does not mention anything about my idea
  • … to my best knowledge, my idea wouldn’t break something for other users
  • … there are no open or closed issues that are related to my idea

Description

So far, the Material Docker container gives people portable access to mkdocs and all of the things it can do. It is my understanding that people rely on running the mkdocs development server via Docker to host their built website, rather than hosting the built static site under a simple webserver.

Googling ‘mkdocs docker’, I find a bunch of containers doing a lot of similar stuff. For example

My proposal is that there could be an official base mkdocs Dockerfile, based on python:3.8.1-alpine3.11 much as yours is. That could provide the mkdocs runtime.

Another Dockerfile with a multi stage build could first build the site using the above image, and then serve using something like Nginx as a second stage with a smaller set of dependencies. That would provide an easy option to publish the site to a container platform (such as many enterprises now use), using Docker to package their built site into a container, which doesn’t need to have Python or mkdocs or any of the plugins on the built image installed.

A sample docker-compose file could allow users to run docker-compose up to start a preview of their site (by mounting the appropriate files and running the base image with the command set to serve using the mkdocs runtime).

A Dockerfile which extends from the base image could install the mkdocs-material dependency and could belong to this project, still allowing people to run a preview of a Material site with no Python knowledge. This image should be no larger than the one you provide already since it does the same thing: install mkdocs and material dependencies over alpine.

I’m open to raising this suggestion in the mkdocs repo, but I thought it would be good to discuss with you, as mentioned here.

I also worry that I might not have explained that well, so if it doesn’t make sense please say so 😃 We use a very similar approach with how we host our mkdocs site on Kubernetes, so I’m fairly confident it is possible.

Use Cases

  • less duplication of images designed to provide an mkdocs runtime
  • an easy way for users to package their site into an efficient production runtime suitable for any Docker hosting platform
  • it would be easier for users not to use the development server in production, reducing the headaches for the mkdocs maintainers
  • users would not have to remember a complicated command to kick off a local preview

Screenshots / Mockups

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
squidfunkcommented, Jul 27, 2020

So, essentially, I think this should be solved as a downstream project. Material for MkDocs is just a template for MkDocs. It provides its own Docker container for convenience, aimed at easing the writing and building of documentation. Hosting is a completely different topic.

If you start working on this, we can review whether it makes sense to advertise a solution in the docs.

1reaction
squidfunkcommented, Jul 27, 2020

Okay, cool! Just comment on this issue if you make any progress 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Compose in production - Docker Documentation
Running Compose on a single server . You can use Compose to deploy an app to a remote Docker host by setting the...
Read more >
A beginner's guide to deploying a Docker application to ...
In this lesson, we are going to learn how Docker Compose works and how it can be used to deploy & manage multiple...
Read more >
Top 8 Docker Best Practices for using Docker in Production
Use an official and verified Docker image as a base image, ... these will already give you great results when using Docker in...
Read more >
How To Optimize Docker Images for Production - DigitalOcean
This will package your sample API in an environment similar to the software you're already running on your Ubuntu server. Inside the image,...
Read more >
Kubernetes
Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found