Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Создание docker образа #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:22.04

WORKDIR /app
COPY . /app

RUN useradd -ms /bin/bash -u 1000 -U -d /app inpx-web

RUN set -e \
&& apt update \
&& apt -y upgrade \
&& apt install -y --no-install-recommends curl wget zip ca-certificates \
&& curl -sL https://deb.nodesource.com/setup_20.x | bash \
&& apt install -y --no-install-recommends nodejs \
&& apt clean

RUN set -e \
&& npm install \
&& npm run build:client \
&& node build/prepkg.js linux \
&& mkdir -p /app/data \
&& chown -R inpx-web:inpx-web /app \
&& mkdir -p /library \
&& rm ./server/config/application_env \
&& echo "chown -R inpx-web:inpx-web /app"

RUN echo "#!/bin/bash" >> /entrypoint.sh \
&& echo "set -e" >> /entrypoint.sh \
&& echo "su inpx-web -c \"node server --lib-dir=/library --app-dir=/app/data --inpx=/app/data/index.inpx --recreate\"" >> /entrypoint.sh \
&& chmod +x /entrypoint.sh

EXPOSE 12380

HEALTHCHECK CMD curl --fail http://localhost:12380 || exit 1

ENTRYPOINT [ "/entrypoint.sh" ]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OPDS-сервер доступен по адресу [http://127.0.0.1:12380/opd

[Отблагодарить автора проекта](https://donatty.com/liberama)

##
##
* [Возможности программы](#capabilities)
* [Использование](#usage)
Expand All @@ -32,6 +33,7 @@ OPDS-сервер доступен по адресу [http://127.0.0.1:12380/opd
* [Сборка релизов](#build)
* [Запуск без сборки релиза](#native_run)
* [Разработка](#development)
* [Запуск в docker](#docker)

<a id="capabilities" />

Expand Down Expand Up @@ -369,4 +371,16 @@ node server --app-dir=.inpx-web
npm run dev
```

<a id="docker" />

### Запуск в docker

```sh
docker build -t inpx-web .
docker run -v /path/to/library:/library -v /path/to/library/flibusta.inpx:/app/data/index.inpx -p 12380:12380 inpx-web
```

Внутри контейнера создаётся пользователь inpx-web и id=1000 и сервер запускается под этим пользователем.
Важно: запускать контейнер и монтировать внутрь папку с архивами в `/library` и файл inpx в `/app/data/index.inpx`.

Связаться с автором проекта: [bookpauk@gmail.com](mailto:bookpauk@gmail.com)