diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..26eedc0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +* +!bin +!lib +!LICENSE +!README +!package.json +!package-lock.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8614ee5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:8.2.1-alpine as builder + +WORKDIR /app +COPY . /app +RUN npm install --production + +FROM node:8.2.1-alpine + +WORKDIR /app +COPY --from=builder /app/ /app/ + +VOLUME /srv +EXPOSE 8080 +ENTRYPOINT ["node","lib/index.js","-p","8080","/srv"] diff --git a/README.md b/README.md index 011cbcc..c38a0cc 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,13 @@ Or node --harmony index.js -p 8080 -d /path/to ``` +Or + +```sh +./build.sh +docker run -d -p 8080:8080 -v /path/to:/srv node-file-manager +``` + We can run node-file-manager in terminal directly. We can specify prot add data root dir by `-p` and `-d`, default with 5000 and scripts directory. Then, we can view localhost:8080/ in our browr. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1c34182 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +cd `dirname "${BASH_SOURCE[0]}"` +image="node-file-manager" +version=`git describe --tags --exact-match 2> /dev/null || git rev-parse --short HEAD` +docker build . -t $image:$version +docker tag $image:{$version,latest}