- Add pyproject.toml with proper metadata and dependency groups - Create multi-stage Dockerfile for backend - Add docker-compose.yml with dev/prod profiles - Create frontend Dockerfile with nginx - Add .dockerignore for optimized builds - Update README with Docker instructions and troubleshooting - Remove requirements.txt in favor of pyproject.toml - Ensure data persistence with Docker volumes
3.9 KiB
Context
The backup tool currently uses a flat requirements.txt for Python dependencies and requires manual setup (venv, pip install, npm install). There is no standardized deployment method, making it difficult to run in production or share with team members. The codebase needs modern Python packaging and containerization for reliable, repeatable deployments.
Current state:
backend/requirements.txtwith pinned versions- Manual venv creation and dependency installation
- No Dockerfile or docker-compose setup
- Frontend served via Vite dev server in development
Goals / Non-Goals
Goals:
- Replace
requirements.txtwith a standardpyproject.tomlwith proper project metadata - Add multi-stage Dockerfile for the backend
- Add
docker-compose.ymlto orchestrate backend + frontend + optional services - Support both development (volume mounts, hot reload) and production (optimized builds) modes
- Maintain backward compatibility with existing manual setup
Non-Goals:
- No changes to application code or API behavior
- No database migration (SQLite remains file-based)
- No Kubernetes or cloud-specific deployment configs
- No changes to frontend build tooling
Decisions
1. Poetry vs setuptools for pyproject.toml
- Decision: Use setuptools with
pyproject.toml(PEP 621) - Rationale: Simpler, no additional tool dependency. setuptools is mature and widely supported. Poetry adds complexity without clear benefit for this project size.
- Alternative considered: Poetry - rejected to avoid adding a new tool dependency
2. Multi-stage Dockerfile
- Decision: Use multi-stage build with separate builder and runtime stages
- Rationale: Smaller final image, faster builds via layer caching. Builder stage installs build dependencies, runtime stage has only necessary files.
- Alternative considered: Single-stage - rejected due to larger image size
3. Backend-only container vs full-stack
- Decision: Provide both options via docker-compose profiles
- Rationale: Default
docker-compose upruns full stack. Users can rundocker-compose --profile dev upfor development with hot reload. - Alternative considered: Separate frontend container - included as option but not default
4. Base image choice
- Decision:
python:3.14-slimfor runtime,python:3.14for builder - Rationale: Slim reduces attack surface and image size. Full image in builder for compiling native extensions if needed.
- Alternative considered: Alpine - rejected due to musl libc compatibility issues with some Python packages
5. Frontend serving in Docker
- Decision: Build frontend in Docker and serve via backend static files in production
- Rationale: Single container to deploy. In development, use Vite dev server with proxy.
- Alternative considered: Separate nginx container - rejected to keep deployment simple
Risks / Trade-offs
-
[Risk] Python 3.14 compatibility: Some dependencies may not have pre-built wheels for Python 3.14
- Mitigation: Use slim image, test build early, pin compatible versions
-
[Risk] Docker image size: Including Node.js for frontend build increases image size
- Mitigation: Multi-stage build ensures Node.js tooling is not in final image
-
[Risk] File permissions with SQLite: Container user may not have write access to SQLite DB file
- Mitigation: Create volume for data directory, set proper user/permissions in Dockerfile
Migration Plan
- Create
pyproject.tomlwith all dependencies fromrequirements.txt - Create Dockerfile and docker-compose.yml
- Test build locally with
docker compose up - Verify all tests pass in container
- Update README with Docker instructions
- Keep
requirements.txttemporarily, mark as deprecated - After validation, remove
requirements.txt
Open Questions
- Should we add a healthcheck endpoint to docker-compose?
- Do we need docker-compose override files for different environments?