Upgrade Python Docker base image
Recipe ID
org.openrewrite.python.migrate.UpgradePythonDockerImageArtifact
org.openrewrite.recipe:rewrite-migrate-pythonUpdate the Python version of Python images in Dockerfiles to a target version: FROM python:<version> base images and COPY --from=<python image> / ADD --from=<python image> stage references (e.g. COPY --from=registry.example.com/approved-images/python:3.10-ubuntu22.04 /usr /usr). Tag suffixes such as -slim are preserved, any patch component is dropped, and an image already on a newer version is left as-is. --from references to named build stages are not image references and are left untouched.
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.migrate.UpgradePythonDockerImage --recipe-option "version=3.12"If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-python:0.11.0Options
| Name | Type | Description |
|---|---|---|
versionrequired | String | The target Python version as MAJOR.MINOR (for example 3.12). Any patch component is dropped; the minor release is the upgrade target.e.g. 3.12 |
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats