A brief description of what this project does and who it's for
This is a Streamlit application that allows users to create customizable QR codes with the option of adding overlaying photos in the background and still getting an easily-recognized QR code. Most free tools online limit your ability to change shapes or add logos or at least hides it behind a paywall or a free trial; this project aims to provide that flexibility for free while maintaining high-quality output.
This project's aim was a mix of interest in QR code beautification in python and a desire to apply Docker best practices I learnt with guidance from the Project "Container Best Practices" in the Dynamic DevOps Roadmap.
-
Modern Package Management: Switched to
uvby Astral. I chose this because it is significantly faster thanpipand provides auv.lockfile for 100% reproducible environments and more reusable thanrequirement.txtfiles. -
Efficient Containerization: I optimized my
Dockerfilewith Docker Best Practices in mind.
- Dependency Management: uv
- DevOps: Docker.
You just need to have Docker installed on your system.
- Run the Container: The image currently resides on Dockerhub registry.
docker run --rm -d -p 8501:8501/tcp menna011/custom-qr-app:2.1
- View the App: Open
http://127.0.0.1:8501in your browser.
-
Essential Practices
- Use Dockerfile linter 🟢
- Check Docker language specific best practices 🟢
- Create a single application per Docker image 🟢
- Create configurable ephemeral containers 🟢
-
Image Practices
- Use optimal base image 🟢
- Pin versions everywhere 🟢
- Create image with the optimal size 🟡
- Use multi-stage whenever possible 🟢
- Avoid any unnecessary files 🟡
-
Security Practices
- Always use trusted images 🟢
- Never use untrusted resources 🟢
- Never store sensitive data in the image 🟢
- Use a non-root user 🟢
- Scan image vulnerabilities 🟢 (Trivy)
-
Misc Practices
- Leverage Docker build cache 🟢
- Avoid system cache 🟢
- Create a unified image across envs 🟡
- Use ENTRYPOINT with CMD 🟢
-
Automated CI/CD Pipeline: Instead of manual building, I would set up GitHub Actions or Jenkins. Every time I push code, the image would be automatically built, scanned for vulnerabilities, and pushed to the registry.
-
Package Management Issues: Packages using entry-point plugins (like qrcode-artistic for this project) must be explicitly declared in pyproject.toml and correctly registered in the .venv inside the image to be recognized by the main library.
-
Using the Official Docker: I Diagnosed and resolved "Permission Denied" errors caused by the Snap version of Docker's security confinement, and therefore installed the official docker, which made working with docker better.
-
Secret Management: Right now, the app is simple, but if I added a database or API keys, I would move away from
ENVvariables in the Dockerfile and use a secure secret manager or.dockerignorecombined with encrypted secrets. -
Deploying app to the cloud: This time, I didn't have the time or resources to deploy the app onto the cloud, so I'd like to try doing that in the near future whether it's this app or another one.