diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..e101931 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,25 @@ +# paperbackup Dockerfile +# Copyright (C) 2024, Kamal Mostafa +# License: MIT License as per + +# https://github.com/intra2net/paperbackup/issues/19 +# Use python:3.9 because: +# qrencode on python >=3.10 fails with: +# SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats + +FROM python:3.9-bookworm + +# dependencies +RUN apt update && apt-get install -y --no-install-recommends \ + libqrencode-dev enscript ghostscript zbar-tools texlive poppler-utils +RUN pip3 install pillow pyx qrencode + +# https://github.com/intra2net/paperbackup/issues/10 +# Preclude ERROR: attempt to perform an operation not allowed by the security policy `gs' +# https://stackoverflow.com/questions/70655631/imagemagick-security-policy-error-in-github-workflow +RUN sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml + +# paperbackup +RUN git clone https://github.com/intra2net/paperbackup.git + +ENTRYPOINT ["/paperbackup/paperbackup.py"] diff --git a/docker/README-Docker.md b/docker/README-Docker.md new file mode 100644 index 0000000..dc92ea7 --- /dev/null +++ b/docker/README-Docker.md @@ -0,0 +1,32 @@ +# Dockerized PaperBackup + +PaperBackup is a command-line tool to create a QR-codes/barcodes to backup text files on paper; +Copyright 2017 by Intra2net AG, Germany. + +This Dockerized version encapsulates `paperbackup` within a Docker container, allowing for deployment in various and otherwise incompatible environments. In particular, this allows `paperbackup` to run on systems with more modern python installations (> 3.9) than the tool may require. + +### Building the Docker Image + +To build the `paperbackup` Docker image, clone the repository and navigate to the directory containing the Dockerfile -- or simply download the Dockerfile and the pair of shell-scripts from that directory -- then run: + +```bash +docker build -t paperbackup . +``` + +### Running the Tool + +Use the included one-liner shell scripts `paperbackup.sh` and `paperbackup-verify.sh` to run the tool within the container: + +```bash +./paperbackup.sh +``` + +```bash +./paperbackup-verify.sh +``` + +## License + +MIT License as per . + +This simple Dockerfile was created by Kamal Mostafa . diff --git a/docker/paperbackup-verify.sh b/docker/paperbackup-verify.sh new file mode 100755 index 0000000..50eb8ff --- /dev/null +++ b/docker/paperbackup-verify.sh @@ -0,0 +1,3 @@ +#!/bin/sh +docker run --rm --volume .:/app --workdir /app \ + --entrypoint=/paperbackup/paperbackup-verify.sh paperbackup $* diff --git a/docker/paperbackup.sh b/docker/paperbackup.sh new file mode 100755 index 0000000..a92798f --- /dev/null +++ b/docker/paperbackup.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker run --rm --volume .:/app --workdir /app paperbackup $*