This document explains how to use Docker with the tree-view-cli project, including both development and production workflows.
The Docker environment is configured for optimal development experience with:
- Fast dependency installation using uv
- Efficient layer caching for quick rebuilds
- Volume mounts for live code editing
- Separate services for testing and coverage viewing
Build and start the development environment:
If you enviroment has Make
make upOr
docker compose up --buildThis will:
- Build the Docker image with your application
- Start two services:
tree-view-cli: Serves test coverage reports at http://localhost:8000dev: Runs the test suite
For teardown the containers
make downOr
docker compose down --remove-orphans --rmi local --volumes- Edit code locally, and changes will be reflected immediately in the container
- Test results and coverage reports are stored in a persistent Docker volume
- Resource limits prevent the container from consuming excessive resources
For production deployment, the Dockerfile is optimized for security and efficiency:
- Uses the official astral-sh/uv Python image
- Implements proper dependency caching
- Runs as a non-root user for enhanced security
- Includes bytecode compilation for better performance
- Minimizes image size through optimal layer management
Build the production image:
docker build -t tree-view-cli .If deploying to a different architecture (e.g., from Apple Silicon to x86):
docker build --platform=linux/amd64 -t tree-view-cli .