Skip to content

Commit cee8580

Browse files
authored
Merge pull request #18 from KEINOS/dockerize-keinos
feat: add Docker
2 parents 6eaf20b + 0f8fd03 commit cee8580

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export/
2+
img/
3+
items/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@ typings/
7070
!.vscode/extensions.json
7171

7272
### Other
73+
export/
7374
img/
7475
items/

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:12-alpine
2+
3+
ARG QIITA_ACCESS_TOKEN
4+
ENV QIITA_ACCESS_TOKEN=$QIITA_ACCESS_TOKEN
5+
COPY . /home/node/
6+
7+
USER root
8+
WORKDIR /home/node
9+
RUN \
10+
npm install && \
11+
mkdir /home/node/export
12+
13+
WORKDIR /home/node/export
14+
ENTRYPOINT npx qiita_export_all

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Qiita v2 API を使って自身の投稿記事全てをエクスポートする
2727

2828
### Node.js & npm
2929

30-
[nvm](https://github.com/creationix/nvm) もしくは [nodist](https://github.com/marcelklehr/nodist)を使ってNode.jsとnpmをインストールすることを推奨します。
30+
[nvm](https://github.com/creationix/nvm) もしくは [nodist](https://github.com/marcelklehr/nodist) を使ってNode.jsとnpmをインストールすることを推奨します。
3131

3232
#### nvm
3333

@@ -71,7 +71,31 @@ export QIITA_ACCESS_TOKEN=9226168a5ef65f8e81153b460e7c78f8b8e53394
7171
npx qiita_export_all
7272
```
7373

74-
### Command Line options
74+
## Docker
75+
76+
Node.js環境がない場合でもDockerが利用可能な場合は、DockerでQiita記事のバックアップができます。
77+
78+
```shellsession
79+
$ # リポジトリのクローンと移動
80+
$ git clone https://github.com/yumetodo/qiita_export_all.git
81+
$ cd qiita_export_all
82+
$ # コンテナの作成
83+
$ docker build -t qiita_export_all:local .
84+
$ # コンテナの起動とアプリの実行。./export に出力されます(token は要置き換え)
85+
$ docker run \
86+
--rm \
87+
--env QIITA_ACCESS_TOKEN=9226168a5ef65f8e81153b460e7c78f8b8e53394 \
88+
-v $(pwd)/export:/home/node/export \
89+
qiita_export_all:local
90+
...
91+
$ # 出力されたファイルの確認
92+
$ tree ./export
93+
...
94+
```
95+
96+
- 確認済み Docker version v19.03.5 (Intel, x86_64, AMD64)
97+
98+
## Command Line options
7599

76100
```plain
77101
Usage: qiita_export_all [options]

0 commit comments

Comments
 (0)