Skip to content

pcourbin-teaching/bookdown-docker

Repository files navigation

Some dockers to use Bookdown.org

Different docker images to use Bookdown.org to prepare PDF, Ebooks or HTML site from R Markdown.

Getting Started

Prerequisities

In order to run this container you'll need docker installed.

Bookdown Base

This docker image is based on r-base:3.6.0. It includes the packages needed to create PDF (LaTeX), EPUB (Pandoc), HTML sites (Gitbook) using the R bookdown package. Note that the image already contains the necessary to include Pyton 2 and Python 3 code in your book.

Environment Variables

  • mainFile - Path to the main file used to create your book. Default: index.Rmd

Volumes

  • /book - Working directory used to create the book. All your files must be in this folder.

Usage

You can simply run the following command to compile your book in the folder ./path/to/my/fodler, with main file index.Rmd into PDF, EPUB, and HTML.

docker run --rm -e "mainFile=index.Rmd" -v ./path/to/my/fodler:/book pcourbin/bookdown:base

If you want to run a specific bookdown::render_book command, for example pdf_book you can use:

docker run --rm -e "mainFile=index.Rmd" -v ./path/to/my/fodler:/book pcourbin/bookdown:base bookdown pdf_book

it will run: bookdown::render_book('index.Rmd', 'bookdown::pdf_book')

Bookdown Extended

Based on the previous image, it simply add support for:

Bookdown User

If you want to use docker images on Linux, it may be convenient to prepare a specific image using a uid equivalent to yours. The file Dockerfile.user helps you.

Environment Variables

  • bookdownuser - Define the name of the user you want to create in the image.
  • uid - Define the uid of the user you want to create in the image.

Usage

Copy the file Dockerfile.user, choose $USER and $UID to correspond to your local user and run

docker build -t mybookdown:user \
  --build-arg bookdownuser=$USER \
  --build-arg uid=$UID \
  -f Dockerfile.user .

You can then simply use:

docker run --rm -e "mainFile=index.Rmd" -v ./path/to/my/fodler:/book mybookdown:user

to compile your book and create the files belonging to the user $UID.

Authors

  • Pierre Courbin - Initial work - PCourbin

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages