Add support for arm64 build

Signed-off-by: YadominJinta <i@yadom.in>
This commit is contained in:
YadominJinta 2021-07-05 17:12:19 +08:00
parent 1bdedf17b6
commit 9c280b064e
2 changed files with 12 additions and 4 deletions

View File

@ -1,8 +1,10 @@
ARG RUNTIME
ARG BUILDPACK
FROM hackmdio/buildpack:node-10-0baafb79 as BUILD
FROM $BUILDPACK as BUILD
COPY --chown=hackmd:hackmd . .
ENV QT_QPA_PLATFORM=offscreen
RUN set -xe && \
git reset --hard && \
@ -18,6 +20,7 @@ RUN set -xe && \
FROM $RUNTIME
USER hackmd
ENV QT_QPA_PLATFORM=offscreen
WORKDIR /home/hackmd/app
COPY --chown=1500:1500 --from=BUILD /home/hackmd/app .
RUN npm install --production && npm cache clean --force && rm -rf /tmp/{core-js-banners,phantomjs}

View File

@ -1,8 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
set -eo pipefail
set -x
if [[ -z $1 || -z $2 ]];then
echo "build.sh [runtime image] [buildpack image]"
exit 1
fi
CURRENT_DIR=$(dirname "$BASH_SOURCE")
GIT_SHA1="$(git rev-parse HEAD)"
@ -11,6 +16,6 @@ GIT_TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/
DOCKER_TAG="${GIT_TAG:-$GIT_SHORT_ID}"
docker build --build-arg RUNTIME=hackmdio/runtime:node-10-d27854ef -t "hackmdio/hackmd:$DOCKER_TAG" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."
docker build --build-arg RUNTIME=$1 --build-arg BUILDPACK=$2 -t "hackmdio/hackmd:$DOCKER_TAG" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."
docker build --build-arg RUNTIME=hackmdio/runtime:node-10-cjk-d27854ef -t "hackmdio/hackmd:$DOCKER_TAG-cjk" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."
docker build --build-arg RUNTIME=$1 --build-arg BUILDPACK=$2 -t "hackmdio/hackmd:$DOCKER_TAG-cjk" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."