feat: dockerize app and convert to pyproject setup
- 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
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Docker image builds successfully
|
||||
The Docker image SHALL build without errors from the project root using `docker build`.
|
||||
|
||||
#### Scenario: Build from project root
|
||||
- **WHEN** developer runs `docker build -t backup-tool .`
|
||||
- **THEN** the image builds successfully with all dependencies installed
|
||||
|
||||
### Requirement: Docker Compose orchestrates full stack
|
||||
The `docker-compose.yml` SHALL start both backend and frontend services with a single command.
|
||||
|
||||
#### Scenario: Start full stack
|
||||
- **WHEN** developer runs `docker compose up`
|
||||
- **THEN** backend API is accessible on port 8000
|
||||
- **AND** frontend is accessible on port 3000
|
||||
- **AND** services can communicate with each other
|
||||
|
||||
### Requirement: Development mode supports hot reload
|
||||
The Docker setup SHALL support development mode with file watching and automatic reloading.
|
||||
|
||||
#### Scenario: Backend code changes trigger reload
|
||||
- **WHEN** developer modifies a Python file in development mode
|
||||
- **THEN** the backend service restarts automatically
|
||||
- **AND** changes are reflected without manual container rebuild
|
||||
|
||||
### Requirement: Production mode uses optimized build
|
||||
The production Docker setup SHALL use multi-stage builds and serve static files efficiently.
|
||||
|
||||
#### Scenario: Production deployment
|
||||
- **WHEN** developer runs `docker compose -f docker-compose.yml up` in production configuration
|
||||
- **THEN** frontend assets are built and served by the backend
|
||||
- **AND** no development servers are running
|
||||
- **AND** image size is minimized
|
||||
|
||||
### Requirement: Data persistence across restarts
|
||||
The Docker setup SHALL preserve SQLite database and backup files across container restarts.
|
||||
|
||||
#### Scenario: Container restart preserves data
|
||||
- **WHEN** docker containers are stopped and restarted
|
||||
- **THEN** all existing backups and job history are preserved
|
||||
- **AND** no data loss occurs
|
||||
@@ -0,0 +1,32 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: pyproject.toml replaces requirements.txt
|
||||
The project SHALL use `pyproject.toml` as the primary dependency and build configuration file.
|
||||
|
||||
#### Scenario: Install from pyproject.toml
|
||||
- **WHEN** developer runs `pip install -e .`
|
||||
- **THEN** all runtime dependencies are installed correctly
|
||||
- **AND** the package is installed in editable mode
|
||||
|
||||
### Requirement: Dependencies are properly declared
|
||||
The `pyproject.toml` SHALL declare all runtime, development, and optional dependencies in appropriate groups.
|
||||
|
||||
#### Scenario: Install with dev dependencies
|
||||
- **WHEN** developer runs `pip install -e ".[dev]"`
|
||||
- **THEN** testing tools (pytest, pytest-asyncio) are installed
|
||||
- **AND** development tools are available
|
||||
|
||||
### Requirement: Package metadata is complete
|
||||
The `pyproject.toml` SHALL include project metadata such as name, version, description, authors, and license.
|
||||
|
||||
#### Scenario: Package info is accessible
|
||||
- **WHEN** user queries package metadata via `pip show backup-tool`
|
||||
- **THEN** name, version, description, and author information are displayed
|
||||
|
||||
### Requirement: Console scripts are defined
|
||||
The `pyproject.toml` SHALL define console entry points for running the application.
|
||||
|
||||
#### Scenario: Run via CLI command
|
||||
- **WHEN** user runs `backup-tool` or `uvicorn backup_tool.main:app`
|
||||
- **THEN** the application starts successfully
|
||||
- **AND** the console script is properly registered
|
||||
Reference in New Issue
Block a user