aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-04-27 20:56:23 +0000
committerterminaldweller <devi@terminaldweller.com>2023-04-27 20:56:23 +0000
commit134e48ee320439fa8b919b5796cb9f0ac6a55619 (patch)
tree4db61a7a1e6771e37d41b0dba31b115f6a114bef
parentmagni can now get a user agent from an env var, fixed the readme for http_proxy (diff)
downloadmagni-134e48ee320439fa8b919b5796cb9f0ac6a55619.tar.gz
magni-134e48ee320439fa8b919b5796cb9f0ac6a55619.zip
added docker
-rw-r--r--Dockerfile19
-rw-r--r--README.md17
2 files changed, 30 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index f33b3fc..ce27ccc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,6 @@
FROM python:3.11.0-slim-buster as python-base
+# RUN echo 'Acquire::http::Proxy "socks5h://192.168.1.214:9995";' > /etc/apt/apt.conf.d/proxy.conf && \
+# echo 'Acquire::https::Proxy "socks5h://192.168.1.214:9995";' >> /etc/apt/apt.conf.d/proxy.conf
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
@@ -7,20 +9,25 @@ ENV PYTHONUNBUFFERED=1 \
POETRY_HOME="/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
- PYSETUP_PATH="/devourer" \
- VENV_PATH="/devourer/.venv"
+ PYSETUP_PATH="/magni" \
+ VENV_PATH="/magni/.venv"
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
FROM python-base as builder-base
ENV POETRY_VERSION=1.2.2
-RUN apt update && apt install -y --no-install-recommends curl build-essential
-RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
+RUN apt-get update && apt-get install -y --no-install-recommends curl build-essential
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+RUN curl -sSL https://install.python-poetry.org | python
+# RUN curl -socks5 socks5h://192.168.1.214:9990 -sSL https://install.python-poetry.org | python
WORKDIR $PYSETUP_PATH
COPY ./pyproject.toml ./
-RUN poetry install --no-dev
+COPY ./poetry.lock ./
+# RUN HTTPS_PROXY=http://192.168.1.214:8118 poetry install --without dev
+RUN poetry install --without dev
FROM python-base as production
COPY --from=builder-base $VENV_PATH $VENV_PATH
COPY ./magni.py $PYSETUP_PATH/magni.py
+COPY ./template.jinja2 $PYSETUP_PATH/
WORKDIR $PYSETUP_PATH
-ENTRYPOINT $PYSETUP_PATH/magni.py
+ENTRYPOINT ["/magni/magni.py"]
diff --git a/README.md b/README.md
index 64307ac..7ddcb6f 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,23 @@ you can obviously use `poetry run` as well:
HTTPS_PROXY=socks5h://127.0.0.1:9094 poetry run ./magni.py --url https://chapmanganato.com/manga-dt980702/chapter-184
```
+### Docker
+
+#### Build
+```sh
+docker build -t magni:latest --load .
+```
+
+#### Run
+```sh
+docker run -p 8086:8086 \
+ -e HTTPS_PROXY=socks5h://192.168.1.100:9050 \
+ -e MAGNI_MODEL_PATH=/opt/magni_models \
+ -e MAGNI_IMAGE_PATH=/opt/magni_images \
+ -v ./models:/opts/magni_models \
+ magni:latest --url https://chapmanganato.com/manga-dt980702/chapter-184
+```
+
## Env Vars
magni recognizes three environment variables:</br>