Sample Python project using uv and an Alpine-based Dev Container.
- Multi-stage Docker setup with dedicated
dev_imageandreleasetargets - Dev Container ready for VS Code (
.devcontainer/devcontainer.json) - Tooling preinstalled in container:
uv,ruff,ty,trivy,prek - Simple app entrypoint exposed as
app
.
├── .devcontainer/
├── src/
│ └── example/
│ ├── __init__.py
│ └── main.py
├── tests/
├── Dockerfile
├── pyproject.toml
└── README.md
- Docker (for Dev Container workflow)
- VS Code + Dev Containers extension
- Optional local workflow:
uv
- Open this folder in VS Code.
- Run Dev Containers: Reopen in Container.
- Wait for the image to build and attach.
When attached, dependencies are synced automatically via postAttachCommand.
From the repository root:
uv sync
uv run appExpected output:
Hello World
- Run app:
uv run app - Run tests:
uv run pytest - Lint/format check:
uv run ruff check . - Type check:
uv run ty check - Run all pre-commit hooks:
prek run --all-files
The Dockerfile defines multiple targets:
dev_image: full development environment used by the Dev Containerrelease: runtime-oriented image for deployment
Example build:
docker build --target dev_image -t python-devcontainer:dev .The script command app maps to:
- module:
example.main - function:
entrypoint
Defined in pyproject.toml under [project.scripts].
MIT (see LICENSE).