Skip to content

Commit abfdba9

Browse files
committed
append docker scripts
1 parent 6f47c65 commit abfdba9

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
fonts/*
3+
output

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.7-alpine3.9
2+
LABEL MAINTAINER="soulteary <soulteary@gmail.com>"
3+
4+
ENV LIBRARY_PATH /lib:/usr/lib
5+
6+
RUN wget https://github.com/soulteary/gitbook2pdf/archive/master.zip -O /tmp/app.zip && \
7+
cd /tmp && unzip app.zip && mv /tmp/gitbook2pdf-master /app
8+
9+
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 && \
10+
cd /app && pip install -r /app/requirements.txt && \
11+
apk del build-base && rm -rf /var/cache/apk/*
12+
13+
VOLUME [ "/app/output" ]
14+
VOLUME [ "/usr/share/fonts/" ]
15+
16+
WORKDIR /app
17+
18+
ENTRYPOINT [ "python", "/app/gitbook.py" ]

IMAGE_NAME.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
soulteary/docker-gitbook-pdf-generator:1.0.0

build-with-mirror/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM python:3.7-alpine3.9
2+
LABEL MAINTAINER="soulteary <soulteary@gmail.com>"
3+
4+
ENV LIBRARY_PATH /lib:/usr/lib
5+
6+
RUN wget https://github.com/soulteary/gitbook2pdf/archive/master.zip -O /tmp/app.zip && \
7+
cd /tmp && unzip app.zip && mv /tmp/gitbook2pdf-master /app
8+
9+
RUN cat /etc/apk/repositories | sed -e "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/" | tee /etc/apk/repositories && \
10+
apk add build-base python3-dev gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev libxslt-dev && \
11+
cd /app && pip install -i https://mirrors.aliyun.com/pypi/simple/ -r /app/requirements.txt && \
12+
apk del build-base && rm -rf /var/cache/apk/*
13+
14+
VOLUME [ "/app/output" ]
15+
VOLUME [ "/usr/share/fonts/" ]
16+
17+
WORKDIR /app
18+
19+
ENTRYPOINT [ "python", "/app/gitbook.py" ]

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '2'
2+
3+
services:
4+
5+
pdf-generator:
6+
image: soulteary/docker-gitbook-pdf-generator:1.0.0
7+
volumes:
8+
- ./output:/app/output:rw
9+
- ./fonts/:/usr/share/fonts:ro
10+
command: "http://self-publishing.ebookchain.org"

make-images.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ "mirror"=="$1" ]]; then
4+
docker build -t $(cat ./IMAGE_NAME.txt) . -f ./build-with-mirror/Dockerfile
5+
else
6+
docker build -t $(cat ./IMAGE_NAME.txt) .
7+
fi;

0 commit comments

Comments
 (0)