forked from appotry/docker-gitbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (73 loc) · 2.96 KB
/
Dockerfile
File metadata and controls
91 lines (73 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
FROM debian:bullseye-slim
MAINTAINER appotry <andycrusoe@gmail.com>
LABEL maintainer="andycrusoe@gmail.com"
LABEL repository="https://github.com/appotry/docker-gitbook"
LABEL homepage="https://blog.17lai.site"
LABEL com.github.actions.name="build-gitbook"
LABEL com.github.actions.description="build or deplay your gitbook"
LABEL com.github.actions.icon="book-open"
LABEL com.github.actions.color="white"
ENV TZ=Asia/Shanghai
ENV GIT_USERNAME="" \
GIT_USEREMAIL="" \
GIT_TOKEN="" \
GIT_REPO="" \
GIT_BRANCH="gh-pages" \
GIT_COMMIT_MESSAGE="Gitbook updated:"
ENV NPM_CONFIG_LOGLEVEL info
# build-essential
# Install Utilities
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends procps build-essential ca-certificates openssl openssh-client git bzip2 curl vim yarn && \
apt-get clean && \
strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 && \
rm -rf /var/lib/apt/lists/*
# Install Node.js
# https://github.com/nvm-sh/nvm
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
npm install -g npm && \
node -v && \
npm -v && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
## Install Gitbook
RUN npm install -g cnpm --registry=http://registry.npmmirror.com && \
export PUPPETEER_SKIP_DOWNLOAD='true' && \
npm install gitbook-cli -g && \
npm install svgexport -g && \
gitbook ls && \
sed -i 's/fs.stat\ =\ statFix(fs.stat)/\/\/fs.stat\ =\ statFix(fs.stat)/g' /usr/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js && \
sed -i 's/fs.fstat\ =\ statFix(fs.fstat)/\/\/fs.fstat\ =\ statFix(fs.fstat)/g' /usr/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js && \
sed -i 's/fs.lstat\ =\ statFix(fs.lstat)/\/\/fs.lstat\ =\ statFix(fs.lstat)/g' /usr/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js && \
cat /usr/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js && \
gitbook fetch && \
npm cache clean --force
# ## Install OpenJDK
RUN apt-get update && \
apt-get install -y --no-install-recommends openjdk-11-jre-headless && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
## Install Calibre
RUN apt-get update && \
apt-get install -y --no-install-recommends calibre fonts-noto fonts-noto-cjk locales-all && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
## Install Graphviz for PlantUML
RUN apt-get update && \
apt-get install -y --no-install-recommends graphviz && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV BOOKDIR /gitbook
VOLUME $BOOKDIR
EXPOSE 4000
WORKDIR $BOOKDIR
COPY book.json /book.json
COPY entrypoint.sh /entrypoint.sh
COPY userRun.sh /userRun.sh
RUN chmod +x /entrypoint.sh && \
chmod +x /userRun.sh
# ENTRYPOINT ["/entrypoint.sh"]
CMD ["gitbook", "--help"]