Skip to content

Commit 66f5054

Browse files
committed
feat: add support for arm64
1 parent f525ab2 commit 66f5054

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: docker/build-push-action@v3
3535
with:
3636
context: .
37-
platforms: linux/amd64
37+
platforms: linux/amd64,linux/arm64
3838
push: ${{ github.event_name != 'pull_request' }}
3939
cache-from: type=registry,ref=yunnysunny/gitbook:buildcache
4040
cache-to: type=registry,ref=yunnysunny/gitbook:buildcache,mode=max

Dockerfile

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,34 @@ RUN ebook-convert --version
55
RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
66
&& sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
77
&& apt-get update \
8-
&& apt-get install --force-yes --no-install-recommends wget fonts-wqy-microhei \
8+
&& apt-get install --force-yes --no-install-recommends curl fonts-wqy-microhei \
99
libgl1-mesa-glx libegl1 libxkbcommon0 libopengl0 -y \
10-
&& apt-get clean
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/
1112

1213
SHELL ["/bin/bash", "-c"]
13-
RUN wget https://mirrors.huaweicloud.com/nodejs/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz
14-
RUN mkdir -p /usr/local/node && tar -zxvf node-v${NODE_VERSION}-linux-x64.tar.gz -C /usr/local/node
15-
ENV PATH="/usr/local/node/node-v${NODE_VERSION}-linux-x64/bin/:${PATH}"
14+
ARG NPM_REGISTRY=https://registry.npmmirror.com
15+
ARG NPM_MIRROR=https://npmmirror.com
16+
RUN if [ "$TARGETARCH" = "arm64" ] ; then \
17+
export ARCH=arm64 ; \
18+
elif [ "$TARGETARCH" = "arm" ] ; then \
19+
export ARCH=armv7l ; \
20+
else \
21+
export ARCH=x64 ; \
22+
fi ; \
23+
if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "arm" ] ; then \
24+
apt-get update \
25+
&& apt-get install libatomic1 --no-install-recommends -y \
26+
&& rm -rf /var/lib/apt/lists/* ; \
27+
fi \
28+
&& curl -fsSLO --compressed "${NPM_MIRROR}/mirrors/node/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.gz" \
29+
&& curl -fsSLO --compressed "${NPM_MIRROR}/mirrors/node/v$NODE_VERSION/SHASUMS256.txt" \
30+
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.gz\$" SHASUMS256.txt | sha256sum -c - \
31+
&& tar -zxvf "node-v$NODE_VERSION-linux-$ARCH.tar.gz" -C /usr/local --strip-components=1 \
32+
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.gz" SHASUMS256.txt \
33+
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
34+
&& npm config set registry ${NPM_REGISTRY}
1635

17-
RUN npm config set registry https://registry.npmmirror.com
1836
RUN which node ; node -v; npm install gitbook-cli -g
1937
RUN gitbook fetch 3.2.3
2038

0 commit comments

Comments
 (0)