Skip to content

Commit

Permalink
first commit of bookdown docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasBeuzen committed Feb 2, 2022
0 parents commit fa11f16
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish_image_to_dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Docker image on DockerHub
on:
push:
branches:
- main
paths:
- 'Dockerfile'
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@master
with:
fetch-depth: '0'

- name: Bump version and push tag
uses: anothrNick/[email protected]
id: bump
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
WITH_V: true

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump.outputs.new_tag }}
release_name: ${{ steps.bump.outputs.new_tag }}
body: |
Changes in this Release
- Rebuilt Docker image and published to DockerHub with new tag
draft: false
prerelease: false

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: tbeuzen/py-pkgs-bookdown
username: ${{ secrets.DOCKER_USERNAME_TB }}
password: ${{ secrets.DOCKER_PASSWORD_TB }}
tags: "latest,${{ steps.bump.outputs.new_tag }}"
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM rocker/verse:4.1.1

# System dependencies
RUN apt-get update && apt-get install -y \
python3-pip

# Install Python dependencies
RUN pip3 install \
jupytext

# Install LaTeX packages
RUN tlmgr install amsmath \
latex-amsmath-dev \
fontspec \
tipa \
unicode-math \
xunicode \
kvoptions \
ltxcmds \
kvsetkeys \
etoolbox \
xcolor \
auxhook \
bigintcalc \
bitset \
etexcmds \
gettitlestring \
hycolor \
hyperref \
intcalc \
kvdefinekeys \
letltxmacro \
pdfescape \
refcount \
rerunfilecheck \
stringenc \
uniquecounter \
zapfding \
pdftexcmds \
infwarerr \
fancyvrb \
framed \
booktabs \
mdwtools \
grffile \
caption \
sourcecodepro \
amscls \
natbib

# increase the ImageMagick resource limits
RUN sed -i 's/256MiB/4GiB/' /etc/ImageMagick-6/policy.xml
RUN sed -i 's/512MiB/4GiB/' /etc/ImageMagick-6/policy.xml
RUN sed -i 's/1GiB/4GiB/' /etc/ImageMagick-6/policy.xml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Python Packages (Tomas Beuzen and Tiffany Timbers)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# py-pkgs Bookdown Docker support

Docker image to support PDF building of the open-source [Python Packages book](https://py-pkgs.org).

## Usage

If you'd like develop and build the Python Packages book to PDF:

1. Install [Docker](https://docs.docker.com/get-docker/).
2. Pull the `py-pkgs-bookdown` images: `docker pull tbeuzen/py-pkgs-bookdown`.
3. Clone the [py-pkgs repository](https://github.com/py-pkgs/py-pkgs) from GitHub: `git clone https://github.com/py-pkgs/py-pkgs.git`.
4. Make any desired changes to source files.
5. Build the book using the `build_bookdown.sh` script.

```bash
$ cd py-pkgs
$ sh build_bookdown.sh
```

A fully-rendered PDF version of the book will be built in `py-pkgs/bookdown/_book/`.

0 comments on commit fa11f16

Please sign in to comment.