From c641de15b3f424688fae68cf608ec44a82a3d648 Mon Sep 17 00:00:00 2001 From: sam-6174 <52174834+sam-6174@users.noreply.github.com> Date: Wed, 21 Sep 2022 12:37:55 -0700 Subject: [PATCH] docker: init compose --- .gitignore | 3 +++ Dockerfile | 7 +++++++ docker/README.md | 33 +++++++++++++++++++++++++++++++++ docker/docker-compose.yml | 20 ++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91f5417 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +docker/.env +docker/output +docker/urls.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..37c0b4e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.8-slim as requirements +COPY requirements.txt . +RUN pip install -r requirements.txt + +FROM requirements +COPY archive-org-downloader.py . +ENTRYPOINT ["/usr/local/bin/python", "archive-org-downloader.py"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..4e9a227 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,33 @@ +### Install Docker Desktop + +See [here](https://www.docker.com/products/docker-desktop/) + + +### Configure Downloader + +```shell +cd ./docker +``` + +Put your desired book URLs in a `./urls.txt` file: + +```shell +echo 'https://archive.org/details/XXXX' >> ./urls.txt +``` + +Place the following contents in a `./.env` file: + +```shell +AD_EMAIL='ARCHIVE.ORG_EMAIL' +AD_PASSWORD='ARCHIVE.ORG_PASSWORD' +AD_RESOLUTION='0' +``` + + +### Run the Downloader + +```shell +docker-compose run archive_downloader +``` + +You can find the downloaded PDFs at `./output/*.pdf` diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..38d52fd --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3.9" +services: + archive_downloader: + build: + context: .. + dockerfile: Dockerfile + volumes: + - ./output:/ad_output:rw + - ./urls.txt:/ad_urls.txt:ro + command: + - "-e" + - "$AD_EMAIL" + - "-p" + - "$AD_PASSWORD" + - "-r" + - "$AD_RESOLUTION" + - "-d" + - "/ad_output" + - "-f" + - "/ad_urls.txt"