diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2004a68
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,30 @@
+FROM node:20-alpine as build
+
+WORKDIR /app
+ENV PATH /app/node_modules/.bin:$PATH
+COPY .babelrc .eslintrc nodemon.json package-lock.json package.json README.md ./
+COPY build ./build/
+COPY client ./client/
+COPY server ./server/
+
+RUN apk add zip
+RUN npm install --omit=dev
+RUN npm run build:client
+RUN node build/prepkg.js linux
+RUN pkg -t node18-linux-x64 -C GZip --options max-old-space-size=4096,expose-gc -o dist/linux/inpx-web .
+
+# Build the prod image
+FROM alpine:latest
+
+# Move to /dist directory as the place for resulting binary folder
+WORKDIR /app
+RUN apk add libgcc libstdc++ gcompat
+RUN mkdir -m 0777 data
+COPY docker_entrypoint.sh entrypoint.sh
+COPY --from=build /app/dist/linux/inpx-web .
+
+EXPOSE 12380
+
+HEALTHCHECK CMD curl --fail http://localhost:12380 || exit 1
+
+ENTRYPOINT [ "/app/entrypoint.sh" ]
diff --git a/README.md b/README.md
index d0957c7..d509a9a 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,7 @@ OPDS-сервер доступен по адресу [http://127.0.0.1:12380/opd
[Отблагодарить автора проекта](https://donatty.com/liberama)
+##
##
* [Возможности программы](#capabilities)
* [Использование](#usage)
@@ -32,6 +33,7 @@ OPDS-сервер доступен по адресу [http://127.0.0.1:12380/opd
* [Сборка релизов](#build)
* [Запуск без сборки релиза](#native_run)
* [Разработка](#development)
+* [Запуск в docker](#docker)
@@ -369,4 +371,22 @@ node server --app-dir=.inpx-web
npm run dev
```
+
+
+### Запуск в docker
+
+Сборка:
+```sh
+docker build -t inpx-web .
+```
+
+Запуск:
+```sh
+docker run -v /path/to/library:/library:ro --user=1000 -p 12380:12380 inpx-web
+```
+
+- В этом случае база данных и конфигурация будут пересоздаваться при каждом запуске. Для того, что сделать конфигурацию персистентной примонтируйте каталог в /app/data добавлением параметра в docker run: `-v /path/to/app_data:/app_data`
+- Использование индекса, находящегося не в директории с библиотекой - передайте в docker run: `-v /path/to/index/flibusta.inpx:/app/index.inpx:ro -e INDEX_FILE=/app/index.inpx`
+- Если используется персистентная конфигурация (см выше), но нужно перечитывать индекс при каждом запуске передайте в docker run: `-e RECREATE=1`
+
Связаться с автором проекта: [bookpauk@gmail.com](mailto:bookpauk@gmail.com)
\ No newline at end of file
diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh
new file mode 100755
index 0000000..a8a8bc8
--- /dev/null
+++ b/docker_entrypoint.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+OPTS="--lib-dir=/library --app-dir=/app/data"
+
+[ -z ${INDEX_FILE+x} ] || OPTS="$OPTS --inpx=\"${INDEX_FILE}\""
+[ -z ${RECREATE+x} ] || OPTS="$OPTS --recreate"
+
+echo Starting ./inpx-web $OPTS
+./inpx-web $OPTS
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index cdefbae..c867359 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,26 +10,51 @@
"hasInstallScript": true,
"license": "CC0-1.0",
"dependencies": {
+ "@babel/core": "^7.20.5",
+ "@babel/eslint-parser": "^7.19.1",
+ "@babel/eslint-plugin": "^7.19.1",
+ "@babel/plugin-proposal-decorators": "^7.20.5",
+ "@babel/preset-env": "^7.20.2",
"@quasar/extras": "^1.15.6",
+ "@vue/compiler-sfc": "^3.2.22",
"axios": "^0.27.2",
+ "babel-loader": "^9.1.0",
"chardet": "^1.5.0",
+ "copy-webpack-plugin": "^11.0.0",
+ "css-loader": "^6.7.2",
+ "css-minimizer-webpack-plugin": "^4.2.2",
"dayjs": "^1.11.6",
+ "eslint": "^8.28.0",
+ "eslint-plugin-vue": "^9.8.0",
"express": "^4.18.2",
"express-basic-auth": "^1.2.1",
"fs-extra": "^10.1.0",
"he": "^1.2.0",
+ "html-webpack-plugin": "^5.5.0",
"iconv-lite": "^0.6.3",
"jembadb": "^5.1.7",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
+ "mini-css-extract-plugin": "^2.7.1",
"minimist": "^1.2.7",
"node-stream-zip": "^1.15.0",
+ "pkg": "^5.8.0",
"quasar": "^2.10.2",
"safe-buffer": "^5.2.1",
+ "showdown": "^2.1.0",
+ "terser-webpack-plugin": "^5.3.6",
"vue": "^3.2.37",
+ "vue-loader": "^17.0.1",
"vue-router": "^4.1.6",
"vuex": "^4.1.0",
+ "vue-eslint-parser": "^9.1.0",
"vuex-persist": "^3.1.3",
+ "vue-style-loader": "^4.1.3",
+ "webpack": "^5.75.0",
+ "webpack-cli": "^5.0.0",
+ "webpack-dev-middleware": "^6.0.1",
+ "webpack-hot-middleware": "^2.25.3",
+ "webpack-merge": "^5.8.0",
"ws": "^8.11.0",
"yazl": "^2.5.1"
},
@@ -37,31 +62,6 @@
"inpx-web": "server/index.js"
},
"devDependencies": {
- "@babel/core": "^7.20.5",
- "@babel/eslint-parser": "^7.19.1",
- "@babel/eslint-plugin": "^7.19.1",
- "@babel/plugin-proposal-decorators": "^7.20.5",
- "@babel/preset-env": "^7.20.2",
- "@vue/compiler-sfc": "^3.2.22",
- "babel-loader": "^9.1.0",
- "copy-webpack-plugin": "^11.0.0",
- "css-loader": "^6.7.2",
- "css-minimizer-webpack-plugin": "^4.2.2",
- "eslint": "^8.28.0",
- "eslint-plugin-vue": "^9.8.0",
- "html-webpack-plugin": "^5.5.0",
- "mini-css-extract-plugin": "^2.7.1",
- "pkg": "^5.8.0",
- "showdown": "^2.1.0",
- "terser-webpack-plugin": "^5.3.6",
- "vue-eslint-parser": "^9.1.0",
- "vue-loader": "^17.0.1",
- "vue-style-loader": "^4.1.3",
- "webpack": "^5.75.0",
- "webpack-cli": "^5.0.0",
- "webpack-dev-middleware": "^6.0.1",
- "webpack-hot-middleware": "^2.25.3",
- "webpack-merge": "^5.8.0"
},
"engines": {
"node": ">=16.16.0"
diff --git a/package.json b/package.json
index fb189ae..4e9af3c 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"build:client-dev": "webpack --config build/webpack.dev.config.js",
"build:all": "npm run build:linux && npm run build:win && npm run build:macos && npm run build:linux-arm64",
"release": "npm run build:all && node build/release.js",
- "postinstall": "npm run build:client-dev"
+ "postinstall": "npm run build:client"
},
"bin": "server/index.js",
"pkg": {
@@ -25,54 +25,54 @@
"assets": "dist/public.json"
},
"devDependencies": {
+ },
+ "dependencies": {
"@babel/core": "^7.20.5",
"@babel/eslint-parser": "^7.19.1",
"@babel/eslint-plugin": "^7.19.1",
"@babel/plugin-proposal-decorators": "^7.20.5",
"@babel/preset-env": "^7.20.2",
+ "@quasar/extras": "^1.15.6",
"@vue/compiler-sfc": "^3.2.22",
+ "axios": "^0.27.2",
"babel-loader": "^9.1.0",
+ "chardet": "^1.5.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.2",
"css-minimizer-webpack-plugin": "^4.2.2",
- "eslint": "^8.28.0",
- "eslint-plugin-vue": "^9.8.0",
- "html-webpack-plugin": "^5.5.0",
- "mini-css-extract-plugin": "^2.7.1",
- "pkg": "^5.8.0",
- "showdown": "^2.1.0",
- "terser-webpack-plugin": "^5.3.6",
- "vue-eslint-parser": "^9.1.0",
- "vue-loader": "^17.0.1",
- "vue-style-loader": "^4.1.3",
- "webpack": "^5.75.0",
- "webpack-cli": "^5.0.0",
- "webpack-dev-middleware": "^6.0.1",
- "webpack-hot-middleware": "^2.25.3",
- "webpack-merge": "^5.8.0"
- },
- "dependencies": {
- "@quasar/extras": "^1.15.6",
- "axios": "^0.27.2",
- "chardet": "^1.5.0",
"dayjs": "^1.11.6",
"express": "^4.18.2",
"express-basic-auth": "^1.2.1",
+ "eslint": "^8.28.0",
+ "eslint-plugin-vue": "^9.8.0",
"fs-extra": "^10.1.0",
"he": "^1.2.0",
+ "html-webpack-plugin": "^5.5.0",
"iconv-lite": "^0.6.3",
"jembadb": "^5.1.7",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
+ "mini-css-extract-plugin": "^2.7.1",
"minimist": "^1.2.7",
"node-stream-zip": "^1.15.0",
+ "pkg": "^5.8.0",
"quasar": "^2.10.2",
"safe-buffer": "^5.2.1",
+ "showdown": "^2.1.0",
+ "terser-webpack-plugin": "^5.3.6",
"vue": "^3.2.37",
+ "vue-loader": "^17.0.1",
"vue-router": "^4.1.6",
"vuex": "^4.1.0",
+ "vue-eslint-parser": "^9.1.0",
"vuex-persist": "^3.1.3",
+ "vue-style-loader": "^4.1.3",
"ws": "^8.11.0",
+ "webpack": "^5.75.0",
+ "webpack-cli": "^5.0.0",
+ "webpack-dev-middleware": "^6.0.1",
+ "webpack-hot-middleware": "^2.25.3",
+ "webpack-merge": "^5.8.0",
"yazl": "^2.5.1"
}
}