A small command-line tool that encodes a URL into a QR code image. Output location and colors are configurable through environment variables, and the app is packaged as a Docker image for reproducible runs anywhere.
requirements.txtpython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Run with the default URL:
python main.py
Encode a specific URL:
python main.py --url https://www.njit.edu
The QR code is saved to the qr_codes/ directory by default.
The following environment variables override the defaults:
| Variable | Default | Description |
|---|---|---|
QR_CODE_DIR | qr_codes | Directory where images are saved |
LOG_DIR | logs | Directory for the log file |
FILL_COLOR | #4a148c | QR code foreground (dark) color |
BACK_COLOR | white | QR code background (light) color |
Note: keep the fill color dark and the background light. Scanners read dark modules on a light background, so inverting them produces a code that will not scan.
Build the image:
docker build -t qr-code-generator-app .
Run it (writes the QR code to a mounted host folder):
docker run --rm -v "$(pwd)/qr_codes:/app/qr_codes" qr-code-generator-app --url https://www.njit.edu
The image is published at zyrielzero/qr-code-generator-app:
docker pull zyrielzero/qr-code-generator-app:latest
docker run --rm zyrielzero/qr-code-generator-app
A GitHub Actions workflow (.github/workflows/docker-image.yml) builds the image and pushes it to DockerHub automatically on every push to main.
Content type
Image
Digest
sha256:cd5ccbfd4…
Size
52.9 MB
Last updated
4 months ago
docker pull zyrielzero/qr-code-generator-app