diff --git a/alpine/Dockerfile b/alpine/Dockerfile index 3d25d07..0fe01f2 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -2,8 +2,6 @@ FROM node:9-alpine ENV TZ=Asia/Shanghai -COPY docker-entrypoint.sh /usr/local/bin - WORKDIR /srv/hexo COPY package.json package.json @@ -11,7 +9,7 @@ COPY package.json package.json RUN apk add --no-cache \ tzdata \ git \ - openssh \ + openssh-client \ openssl \ && npm install \ && mkdir -p ~/.ssh \ @@ -25,6 +23,8 @@ EXPOSE 4000 WORKDIR /srv/hexo-src +COPY docker-entrypoint.sh /usr/local/bin + ENTRYPOINT ["docker-entrypoint.sh"] CMD build diff --git a/alpine/docker-compose.test.yml b/alpine/docker-compose.test.yml new file mode 100644 index 0000000..05d4fca --- /dev/null +++ b/alpine/docker-compose.test.yml @@ -0,0 +1,3 @@ +sut: + build: . + command: version diff --git a/alpine/docker-entrypoint.sh b/alpine/docker-entrypoint.sh index 96967b4..864674d 100755 --- a/alpine/docker-entrypoint.sh +++ b/alpine/docker-entrypoint.sh @@ -2,8 +2,12 @@ START=`date "+%F %T"` -if [ $1 = "sh" ];then - sh +if [ $1 = "sh" ];then sh; exit 0; fi + +if [ $1 = "version" ];then + cd ../hexo + tar -zxvf node_modules.tar.gz > /dev/null 2>&1 + ./node_modules/hexo/bin/hexo version exit 0 fi diff --git a/alpine/package.json b/alpine/package.json index 795e2b3..01ce51a 100644 --- a/alpine/package.json +++ b/alpine/package.json @@ -4,7 +4,7 @@ "author": "khs1994.com", "private": true, "hexo": { - "version": "3.4.2" + "version": "3.4.3" }, "scripts": { "generate": "./node_modules/hexo/bin/hexo g", @@ -12,7 +12,7 @@ "version": "./node_modules/hexo/bin/hexo version" }, "dependencies": { - "hexo": "^3.4.2", + "hexo": "^3.4.3", "hexo-deployer-git": "^0.3.1", "hexo-generator-archive": "^0.1.5", "hexo-generator-category": "^0.1.3",