Merge pull request #1518 from hackmdio/feat/node-10-build

Change to use nodejs 10.20.1
This commit is contained in:
Raccoon 2020-05-18 13:20:51 +08:00 committed by GitHub
commit 1c38d2477d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,6 @@
FROM hackmdio/buildpack:1.0.4 as BUILD ARG RUNTIME
FROM hackmdio/buildpack:node-10-0baafb79 as BUILD
COPY --chown=hackmd:hackmd . . COPY --chown=hackmd:hackmd . .
@ -12,11 +14,12 @@ RUN set -xe && \
rm -rf .git .gitignore .travis.yml .dockerignore .editorconfig .babelrc .mailmap .sequelizerc.example \ rm -rf .git .gitignore .travis.yml .dockerignore .editorconfig .babelrc .mailmap .sequelizerc.example \
test docs contribute \ test docs contribute \
package-lock.json webpack.prod.js webpack.htmlexport.js webpack.dev.js webpack.common.js \ 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 FROM $RUNTIME
USER hackmd USER hackmd
WORKDIR /home/hackmd/app WORKDIR /home/hackmd/app
COPY --chown=1500:1500 --from=BUILD /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 EXPOSE 3000
ENTRYPOINT ["/home/hackmd/app/docker-entrypoint.sh"] ENTRYPOINT ["/home/hackmd/app/docker-entrypoint.sh"]

View File

@ -1,5 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail
set -x
CURRENT_DIR=$(dirname "$BASH_SOURCE") 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="${GIT_SHA1:0:8}"
GIT_TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null || echo "")
DOCKER_TAG="${GIT_TAG:-$GIT_SHORT_ID}"
docker build --build-arg RUNTIME=hackmdio/runtime:node-10-0baafb79 -t "hackmdio/hackmd:$DOCKER_TAG" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."
docker build --build-arg RUNTIME=hackmdio/runtime:node-10-cjk-0baafb79 -t "hackmdio/hackmd:$DOCKER_TAG-cjk" -f "$CURRENT_DIR/Dockerfile" "$CURRENT_DIR/.."