├── .github └── workflows │ ├── lint-dockerfile.yml │ └── build-image.yml ├── Makefile ├── texpkgs.txt ├── Dockerfile ├── LICENSE └── README.md /.github/workflows/lint-dockerfile.yml: -------------------------------------------------------------------------------- 1 | name: Lint Dockerfile 2 | on: 3 | push: 4 | branches: [ master ] 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout repository 10 | uses: actions/checkout@v2 11 | - name: Lint Dockerfile 12 | uses: hadolint/hadolint-action@v1.5.0 13 | with: 14 | dockerfile: Dockerfile 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Xiaodong Xu 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | PKG = bookdown 6 | REPO = ${USER}/${PKG} 7 | 8 | all: build tag push 9 | 10 | lint: Dockerfile 11 | hadolint $< 12 | 13 | build: Dockerfile 14 | docker buildx build -t ${REPO} . 15 | 16 | tag: build 17 | docker tag ${REPO} ${REPO}:$(shell date -u +%Y%m%d) 18 | docker tag ${REPO} ${REPO}:v$(shell docker run --rm ${REPO} \ 19 | Rscript -e "packageVersion('${PKG}')" | cut -d' ' -f2 | sed "s/‘//;s/’//") 20 | 21 | push: tag 22 | docker push -a ${REPO} 23 | 24 | .PHONY: all 25 | -------------------------------------------------------------------------------- /.github/workflows/build-image.yml: -------------------------------------------------------------------------------- 1 | name: Build image 2 | on: 3 | schedule: 4 | - cron: '30 23 * * *' 5 | push: 6 | branches: 7 | - 'master' 8 | paths-ignore: 9 | - '*.md' 10 | workflow_dispatch: 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | env: 15 | USER: ${{ secrets.DOCKER_ID }} 16 | PASS: ${{ secrets.DOCKER_PW }} 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v2 20 | - name: Login to Docker Hub 21 | run: docker login -u "$USER" -p "$PASS" 22 | - name: Build and push image 23 | run: USER=$USER make 24 | -------------------------------------------------------------------------------- /texpkgs.txt: -------------------------------------------------------------------------------- 1 | adobemapping 2 | arphic 3 | beamer 4 | cjk 5 | cjkpunct 6 | cns 7 | ctablestack 8 | ctex 9 | everyhook 10 | fandol 11 | fonts-tlwg 12 | fp 13 | garuda-c90 14 | latex-base-dev 15 | latex-firstaid-dev 16 | luatexbase 17 | luatexja 18 | makeindex 19 | metalogo 20 | mptopdf 21 | ms 22 | norasi-c90 23 | pgf 24 | platex 25 | platex-tools 26 | ptex 27 | ptex-base 28 | ptex-fonts 29 | realscripts 30 | svn-prov 31 | translator 32 | ttfutils 33 | uhc 34 | ulem 35 | uplatex 36 | uptex 37 | uptex-base 38 | uptex-fonts 39 | wadalab 40 | xcjk2uni 41 | xecjk 42 | xltxtra 43 | xpinyin 44 | zhmetrics 45 | zhmetrics-uptex 46 | zhnumber 47 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Xiaodong Xu 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | FROM archlinux:base-devel 6 | 7 | LABEL org.opencontainers.image.authors="xuxiaodong@pm.me" 8 | 9 | # hadolint ignore=DL4006,SC2046 10 | RUN pacman -Syu --noconfirm r pandoc pandoc-crossref && \ 11 | yes | pacman -Scc && \ 12 | Rscript -e "install.packages(c('bookdown', 'tinytex'), \ 13 | repos = c(CRAN = 'https://cran.case.edu'))" && \ 14 | Rscript -e "tinytex::install_tinytex()" && \ 15 | /root/bin/tlmgr install $(curl -L https://github.com/xuxiaodong/bookdown-container/raw/master/texpkgs.txt | tr '\n' ' ') || true 16 | 17 | ENV PATH $PATH:/root/bin 18 | 19 | WORKDIR /work 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Xiaodong Xu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | # bookdown-container 8 | 9 | [![Build image](https://github.com/xuxiaodong/bookdown-container/actions/workflows/build-image.yml/badge.svg)](https://github.com/xuxiaodong/bookdown-container/actions/workflows/build-image.yml) ![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/toyland/bookdown/v0.24) [![Docker Image Size (tag)](https://img.shields.io/docker/image-size/toyland/bookdown/latest)](https://hub.docker.com/r/toyland/bookdown) [![Docker Pulls](https://img.shields.io/docker/pulls/toyland/bookdown)](https://hub.docker.com/r/toyland/bookdown) [![Twitter](https://img.shields.io/twitter/follow/linuxtoy?style=social)](https://twitter.com/intent/follow?screen_name=linuxtoy) 10 | 11 | 本项目旨在通过容器化的方式来方便的运行 Bookdown,目前包含其最新版本 0.24。除此之外,该镜像同时还涵盖下列软件包: 12 | 13 | - R 4.1.2 14 | - Pandoc 2.14.1 15 | - Pandoc-crossref 0.3.12.0 16 | - R Markdown 2.11 17 | - Blogdown 1.5 18 | - Distill 1.3 19 | - Rticles 0.21 20 | - Vitae 0.4.2 21 | - Tufte 0.10 22 | - Knitr 1.36 23 | - TinyTex 0.34 24 | 25 | ## 手动构建 26 | 27 | docker build -t bookdown . 28 | 29 | ## 直接使用 30 | 31 | docker pull toyland/bookdown # 最新版 32 | docker pull toyland/bookdown:v0.24 # 特定版本 33 | docker pull toyland/bookdown:20210816 # 每日快照版 34 | 35 | ## 渲染文档 36 | 37 | - 将 R Markdown 渲染成 PDF 38 | 39 | docker run --rm -v $PWD:/work toyland/bookdown Rscript -e "rmarkdown::render('file.Rmd', 'pdf_document')" 40 | 41 | - 将 Bookdown 渲染成 PDF 42 | 43 | docker run --rm -v $PWD:/work toyland/bookdown Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book')" 44 | 45 | ## 官方文档参考 46 | 47 | - [R Markdown](https://rmarkdown.rstudio.com) 48 | - [Bookdown](https://bookdown.org/yihui/bookdown/) 49 | 50 | ## 许可 51 | 52 | MIT 53 | 54 | Copyright (c) 2021 Xiaodong Xu 55 | --------------------------------------------------------------------------------