-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
103 lines (84 loc) · 3.55 KB
/
Dockerfile
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
92
93
94
95
96
97
98
99
100
101
102
103
FROM debian:bullseye-slim
MAINTAINER appotry <[email protected]>
LABEL maintainer="[email protected]"
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 gnupg openssl openssh-client git bzip2 curl vim yarn && \
apt-get clean && \
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/*
# https://github.com/nodesource/distributions?tab=readme-ov-file#installation-instructions
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
NODE_MAJOR=20 && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
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 && \
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 ls && \
npm cache clean --force
# gitbook fetch && \
# ## 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 for epub、pdf
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"]