From 209cd29b7117a6e719cb83f70bd5c74dc23979a1 Mon Sep 17 00:00:00 2001 From: Raccoon Date: Sun, 17 May 2020 19:48:17 +0800 Subject: [PATCH] feat: change base image to node 10.20.1 Signed-off-by: Raccoon --- deployments/Dockerfile | 9 ++++++--- deployments/build.sh | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/deployments/Dockerfile b/deployments/Dockerfile index e1ae774a..8bb85428 100644 --- a/deployments/Dockerfile +++ b/deployments/Dockerfile @@ -1,4 +1,4 @@ -FROM hackmdio/buildpack:1.0.4 as BUILD +FROM hackmdio/buildpack:node-10-0baafb79 as BUILD COPY --chown=hackmd:hackmd . . @@ -12,11 +12,14 @@ RUN set -xe && \ rm -rf .git .gitignore .travis.yml .dockerignore .editorconfig .babelrc .mailmap .sequelizerc.example \ test docs contribute \ package-lock.json webpack.prod.js webpack.htmlexport.js webpack.dev.js webpack.common.js \ - config.json.example README.md CONTRIBUTING.md AUTHORS + config.json.example README.md CONTRIBUTING.md AUTHORS node_modules -FROM hackmdio/runtime:1.0.6 +ARG RUNTIME=hackmdio/runtime:node-10-0baafb79 + +FROM hackmdio/runtime:node-10-0baafb79 USER hackmd 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} EXPOSE 3000 ENTRYPOINT ["/home/hackmd/app/docker-entrypoint.sh"] diff --git a/deployments/build.sh b/deployments/build.sh index 10b5686b..bd0e09e1 100755 --- a/deployments/build.sh +++ b/deployments/build.sh @@ -2,4 +2,12 @@ CURRENT_DIR=$(dirname "$BASH_SOURCE") -docker build -t hackmdio/codimd -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.." +GIT_SHA1="$(git rev-parse HEAD)" +GIT_SHORT_ID="${SHA1:0:8}" +GIT_TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h')) + +DOCKER_TAG="${GIT_TAG:-$GIT_SHORT_ID}" + +docker build -t "hackmdio/codimd:$DOCKER_TAG" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.." + +docker build --build-arg RUNTIME=node-10-cjk-0baafb79 -t "hackmdio/codimd:$DOCKER_TAG-cjk" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."