diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c7bad56 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.git +.gitignore +__pycache__/ +*.pyc +*.pyo +*.log +.venv/ +venv/ +debug-run.json +downloads/ +state/ +.vscode/ diff --git a/.gitignore b/.gitignore index f03db00..3b58344 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ venv/ # Local debug and runtime artifacts debug-run.json *.log +state/ +downloads/ # IDE .vscode/*.code-workspace diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6368ac4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/playwright/python:v1.52.0-jammy + +WORKDIR /app + +COPY requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir -r /app/requirements.txt + +COPY main.py /app/main.py +COPY README.md /app/README.md + +ENTRYPOINT ["python", "/app/main.py"] +CMD ["-h"] diff --git a/README.md b/README.md index 1734a3c..164522c 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,37 @@ Die Session wird lokal gespeichert in: python main.py download --from 2025-01-01 --to 2025-12-31 ``` +## Docker Compose + +Container-Image bauen: + +```powershell +cd c:\projekte\amazon_invoice_downloader +docker compose build +``` + +Rechnungen im Container herunterladen: + +```powershell +docker compose run --rm amazon-invoice-downloader download --from 2025-01-01 --to 2025-12-31 --headless true +``` + +Persistente Ordner: + +- `./state` -> `/root/.amazon_invoice_downloader` (config + session) +- `./downloads` -> `/downloads` (Ausgabedateien) + +Falls du bereits lokal konfiguriert hast, kopiere diese Dateien nach `./state`: + +- `config.json` +- `storage_state.json` + +Optionaler Zielordner im Container: + +```powershell +docker compose run --rm amazon-invoice-downloader download --from 2025-01-01 --to 2025-12-31 --output /downloads --headless true +``` + Optionen: - `--output `: anderes Zielverzeichnis diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..446692e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + amazon-invoice-downloader: + build: + context: . + dockerfile: Dockerfile + image: amazon-invoice-downloader:latest + container_name: amazon-invoice-downloader + working_dir: /app + stdin_open: true + tty: true + volumes: + - ./downloads:/downloads + - ./state:/root/.amazon_invoice_downloader + command: ["-h"] diff --git a/requirements.txt b/requirements.txt index facef3c..c1bd75c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ playwright>=1.52.0 -requests>=2.32.0 dateparser>=1.2.0