From fe46b8d4ef309c75cb8d5a55a5b72b8f83424f33 Mon Sep 17 00:00:00 2001 From: dece Date: Fri, 6 Nov 2020 11:43:29 +0100 Subject: [PATCH] docker: add Dockerfile with instructions --- Dockerfile | 22 ++++++++++++++++++++++ README.md | 19 ++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..def1eed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.7-slim + +ARG UID +ARG GID + +ENV DEBIAN_FRONTEND noninteractive + +ADD edmond /app/edmond +WORKDIR /app + +RUN pip install requests irc +RUN pip install -r edmond/plugins/requirements.txt + +RUN groupadd --gid ${GID} edmond +RUN useradd --uid ${UID} --gid edmond \ + --shell /usr/sbin/nologin --create-home --no-log-init \ + edmond + +ENV DEBIAN_FRONTEND teletype + +USER edmond +ENTRYPOINT ["python", "-m", "edmond"] diff --git a/README.md b/README.md index db66b13..d579da5 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,27 @@ New version of the infamous IRC bot. Installation ------------ -Clone the repository and install main dependencies using Pipenv: +Clone the repository. + +The preferred installation way is using Docker: ```bash -pipenv install +# Build image with dependencies. +docker build -t edmond --build-arg UID=1000 --build-arg GID=1000 . +# Run container with config/resources/storage mount. +docker run -d \ + -it \ + -v $(pwd)/config.json:/app/config.json \ + -v $(pwd)/resources:/app/resources \ + -v $(pwd)/storage.json:/app/storage.json \ + edmond \ + -c config.json ``` -Plugins dependencies can be manually installed with +Else you can install dependencies and run it in a virtual env: ```bash +pipenv install pipenv run pip install -r edmond/plugins/requirements.txt +pipenv run python -m edmond ```