Skip to content

Commit

Permalink
append docker scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed May 7, 2019
1 parent 6f47c65 commit abfdba9
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
fonts/*
output
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.7-alpine3.9
LABEL MAINTAINER="soulteary <soulteary@gmail.com>"

ENV LIBRARY_PATH /lib:/usr/lib

RUN wget https://github.com/soulteary/gitbook2pdf/archive/master.zip -O /tmp/app.zip && \
cd /tmp && unzip app.zip && mv /tmp/gitbook2pdf-master /app

RUN apk add build-base python3-dev gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev libxslt-dev && \
cd /app && pip install -r /app/requirements.txt && \
apk del build-base && rm -rf /var/cache/apk/*

VOLUME [ "/app/output" ]
VOLUME [ "/usr/share/fonts/" ]

WORKDIR /app

ENTRYPOINT [ "python", "/app/gitbook.py" ]
1 change: 1 addition & 0 deletions IMAGE_NAME.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
soulteary/docker-gitbook-pdf-generator:1.0.0
19 changes: 19 additions & 0 deletions build-with-mirror/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.7-alpine3.9
LABEL MAINTAINER="soulteary <soulteary@gmail.com>"

ENV LIBRARY_PATH /lib:/usr/lib

RUN wget https://github.com/soulteary/gitbook2pdf/archive/master.zip -O /tmp/app.zip && \
cd /tmp && unzip app.zip && mv /tmp/gitbook2pdf-master /app

RUN cat /etc/apk/repositories | sed -e "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/" | tee /etc/apk/repositories && \
apk add build-base python3-dev gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev libxslt-dev && \
cd /app && pip install -i https://mirrors.aliyun.com/pypi/simple/ -r /app/requirements.txt && \
apk del build-base && rm -rf /var/cache/apk/*

VOLUME [ "/app/output" ]
VOLUME [ "/usr/share/fonts/" ]

WORKDIR /app

ENTRYPOINT [ "python", "/app/gitbook.py" ]
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '2'

services:

pdf-generator:
image: soulteary/docker-gitbook-pdf-generator:1.0.0
volumes:
- ./output:/app/output:rw
- ./fonts/:/usr/share/fonts:ro
command: "http://self-publishing.ebookchain.org"
7 changes: 7 additions & 0 deletions make-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

if [[ "mirror"=="$1" ]]; then
docker build -t $(cat ./IMAGE_NAME.txt) . -f ./build-with-mirror/Dockerfile
else
docker build -t $(cat ./IMAGE_NAME.txt) .
fi;

0 comments on commit abfdba9

Please sign in to comment.