forked from bookpauk/inpx-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes bookpauk#16
- Loading branch information
Showing
5 changed files
with
431 additions
and
1,604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 Brotli --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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
<a id="capabilities" /> | ||
|
||
|
@@ -369,4 +371,22 @@ node server --app-dir=.inpx-web | |
npm run dev | ||
``` | ||
|
||
<a id="docker" /> | ||
|
||
### Запуск в 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` | ||
|
||
Связаться с автором проекта: [[email protected]](mailto:[email protected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.