From 0c94bb422276259aa4a6626c6a4d1c939b7c7bfa Mon Sep 17 00:00:00 2001 From: Bestony Date: Fri, 29 Nov 2019 23:50:52 +0800 Subject: [PATCH 1/5] feat: add docker support usage: - ./hexod hexo init - ./hexod hexo clean --- Dockerfile | 5 +++++ hexod | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 Dockerfile create mode 100755 hexod diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..37e6a1cf15 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM node:10 + +RUN npm install -g hexo-cli + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/hexod b/hexod new file mode 100755 index 0000000000..e67418d6d2 --- /dev/null +++ b/hexod @@ -0,0 +1,6 @@ +#!/bin/sh +docker run \ + --interactive --tty --rm \ + --volume "$PWD":/hexosite \ + --workdir /hexosite \ + bestony/hexojs:latest "$@" \ No newline at end of file From 5b02993374164d496a4ceb324435772e95060a3c Mon Sep 17 00:00:00 2001 From: Bestony Date: Fri, 29 Nov 2019 23:57:17 +0800 Subject: [PATCH 2/5] feat: add docker serve support usage: - ./dockerd hexo s --- hexod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hexod b/hexod index e67418d6d2..e2608b2086 100755 --- a/hexod +++ b/hexod @@ -3,4 +3,5 @@ docker run \ --interactive --tty --rm \ --volume "$PWD":/hexosite \ --workdir /hexosite \ - bestony/hexojs:latest "$@" \ No newline at end of file + -p 4000:4000 \ + bestony/hexojs:latest "$@" From daea4835df7a694f8e95fecb09832e93d0edb5a2 Mon Sep 17 00:00:00 2001 From: Bestony Date: Sat, 30 Nov 2019 00:40:04 +0800 Subject: [PATCH 3/5] feat: clean invoke command usage: - hexod clean --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 37e6a1cf15..14f333356b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,4 @@ FROM node:10 RUN npm install -g hexo-cli -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash","-c","hexo"] \ No newline at end of file From 5fe7235d63b69af6d5999ccbd51a0cb8a60d51a7 Mon Sep 17 00:00:00 2001 From: Bestony Date: Sat, 30 Nov 2019 00:54:38 +0800 Subject: [PATCH 4/5] feat: use node-alpine --- Dockerfile | 6 ++++-- hexod | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 14f333356b..0fdaa1ab3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -FROM node:10 +FROM node:current-alpine +RUN apk update && apk add bash git RUN npm install -g hexo-cli -CMD ["/bin/bash","-c","hexo"] \ No newline at end of file + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/hexod b/hexod index e2608b2086..91a3bc20cb 100755 --- a/hexod +++ b/hexod @@ -1,7 +1,7 @@ #!/bin/sh docker run \ --interactive --tty --rm \ - --volume "$PWD":/hexosite \ - --workdir /hexosite \ + --volume "$PWD":/app \ + --workdir /app \ -p 4000:4000 \ - bestony/hexojs:latest "$@" + bestony/hexojs:latest "hexo" "$@" From 8463cd6df4d5b6d3ee92970c4d08fa6723046857 Mon Sep 17 00:00:00 2001 From: Bestony Date: Sat, 30 Nov 2019 01:24:24 +0800 Subject: [PATCH 5/5] feat: replace bash with ash --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0fdaa1ab3d..276c81663b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:current-alpine -RUN apk update && apk add bash git +RUN apk update && apk --no-cache add git RUN npm install -g hexo-cli -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/ash"] \ No newline at end of file