From 1a984c685b7e2158889fb98b95215ad461811f96 Mon Sep 17 00:00:00 2001 From: Azrea Amis Date: Sat, 8 May 2021 21:26:39 +0000 Subject: [PATCH 1/3] Add Dockerfile --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0308ef5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM alpine:latest as install + +# Package list taken from Pillow documentation: +# https://pillow.readthedocs.io/en/stable/installation.html#building-on-linux +RUN apk add tiff-dev jpeg-dev openjpeg-dev zlib-dev freetype-dev lcms2-dev \ + libwebp-dev tcl-dev tk-dev harfbuzz-dev fribidi-dev libimagequant-dev \ + libxcb-dev libpng-dev gcc musl-dev python3 python3-dev py3-pip py3-cryptography + +FROM install as poetry + +# We don't need poetry in the final container. +RUN pip install poetry + +COPY . /leech + +RUN cd /leech && poetry export > requirements.txt + +FROM install + +COPY --from=poetry /leech /leech +RUN pip3 install -r /leech/requirements.txt + +WORKDIR /work + +ENTRYPOINT ["/leech/leech.py"] From 98b4622bd5e52e84f60bc12ac91ed0090a85fee7 Mon Sep 17 00:00:00 2001 From: Azrea Amis Date: Sat, 8 May 2021 21:38:22 +0000 Subject: [PATCH 2/3] Add Docker info to README --- README.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.markdown b/README.markdown index f806efa..d09b260 100644 --- a/README.markdown +++ b/README.markdown @@ -127,6 +127,21 @@ Adding new site handers To add support for a new site, create a file in the `sites` directory that implements the `Site` interface. Take a look at `ao3.py` for a minimal example of what you have to do. +Docker +--- + +You can build the project's Docker container like this: + +```shell +docker build . -t kemayo/leech:snapshot +``` + +The container's entrypoint runs `leech` directly and sets the current working directory to `/work`, so you can mount any directory there: + +```shell +docker run -it --rm -v ${DIR}:/work kemayo/leech:snapshot download [[URL]] +``` + Contributing --- From 674a5b7e6b1907416329d344e74f85fab33e73f4 Mon Sep 17 00:00:00 2001 From: Azrea Amis Date: Sun, 9 May 2021 06:19:53 +0000 Subject: [PATCH 3/3] Simplify Dockerfile Replace intervenining container with just disabling virtualenvs installing via poetry. --- Dockerfile | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0308ef5..1fa6cb6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,19 @@ -FROM alpine:latest as install +FROM alpine:latest # Package list taken from Pillow documentation: # https://pillow.readthedocs.io/en/stable/installation.html#building-on-linux RUN apk add tiff-dev jpeg-dev openjpeg-dev zlib-dev freetype-dev lcms2-dev \ libwebp-dev tcl-dev tk-dev harfbuzz-dev fribidi-dev libimagequant-dev \ - libxcb-dev libpng-dev gcc musl-dev python3 python3-dev py3-pip py3-cryptography - -FROM install as poetry - -# We don't need poetry in the final container. -RUN pip install poetry + libxcb-dev libpng-dev gcc musl-dev python3 python3-dev py3-pip py3-cryptography \ + && pip install poetry COPY . /leech -RUN cd /leech && poetry export > requirements.txt - -FROM install - -COPY --from=poetry /leech /leech -RUN pip3 install -r /leech/requirements.txt +RUN cd /leech \ + && poetry config virtualenvs.create false \ + && poetry install --no-dev WORKDIR /work ENTRYPOINT ["/leech/leech.py"] +