From 8cd0ee513bf4e7b7116d454c87c343ab1f20d991 Mon Sep 17 00:00:00 2001 From: David Ross Date: Mon, 16 Sep 2024 21:19:39 +0100 Subject: [PATCH] Add dockerfile --- .dockerignore | 47 +++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 21 +++++++++++++++++++++ Makefile | 9 +++++++++ docs/web-app.md | 10 +++++----- 4 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..749e387 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,47 @@ +.git/ +.pytest_cache/ +.tox/ +.coverage +.gitignore +*.pyc +*.pyo +*.pyd +*.swp +*.swo +*~ +*.orig +*.egg +._* +*.log +.DS_Store +pip-log.txt +build/* +dist/* +tmp/* +.tmp/* +env/* +_build/* +*results.xml +.vagrant +.idea +.cache +*.mo +EGG-INFO +.eggs/ +.coverage +*settings.yaml +local-settings.yaml +simulate_metadata_event.py +simulate_completes_event.py +scripts/*.json +capn.egg-info/* +.tox/* +.pytest_cache/ +htmlcov/* +tags +venv/ +/capn_release.html +*egg-info/ +TODO +volumes/ +Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..17b1d66 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# docker build -t manga . +# docker run manga + +FROM python:3.8-slim-bullseye + + +WORKDIR /app +COPY . /app + +ENV PYTHONPATH=/app + +RUN apt-get update \ + && apt-get -y --no-install-recommends install gcc libxml2-dev libxslt-dev python3-dev python3-lxml \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + +RUN pip install --no-cache-dir --upgrade pip \ + && pip install --no-cache-dir -r dev-requirements.txt + +# ENTRYPOINT ["python3", "scraper/"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..97eff73 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ + +build: + docker build -t manga:latest . + +run: + docker run -v $(PWD):/app -p 4444:4444 --rm manga:latest python3 scraper/ $(ARGS) + +test: + docker run -v $(PWD):/app --rm manga:latest python3 -m pytest tests/ diff --git a/docs/web-app.md b/docs/web-app.md index c684056..98a1691 100644 --- a/docs/web-app.md +++ b/docs/web-app.md @@ -21,7 +21,7 @@ sources: LIST[STR] Response: -```json +``` [ { 'title': 'dragonball', @@ -48,7 +48,7 @@ source: STR Using pre-signed S3 URLS allows us to keep the S3 bucket private and time limit the URLs access -```json +``` [ { 'title': 'dragonball', @@ -67,7 +67,7 @@ As we have no relational data we can just store the information in a NoSQL datab One database, one collection (`mangas`) with all documents: -```json +``` { 'title': 'dragonball', 'volume': 98, @@ -98,7 +98,7 @@ Save password hashes to DB - Response: -```json +``` { "success": true, "message": "successfully registered" @@ -120,7 +120,7 @@ POST /v1/login - Response: -```json +``` { 'token': }