Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Nov 3, 2025

Backport of #12627 to release/13.0

/cc @eerhardt @copilot

Customer Impact

Previously, Dockerfiles were only generated for Python apps using UV. Non-UV Python apps had no automatic containerization support.

Testing

Added new automated tests. Manually tested the playground\python\instrumented_script app produces a docker image successfully.

Risk

Only affects Python apps, and only if they aren't using UV.

Regression?

No

@github-actions
Copy link
Contributor Author

github-actions bot commented Nov 3, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12640

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12640"

@eerhardt eerhardt requested a review from davidfowl November 3, 2025 22:38
@eerhardt eerhardt added the Servicing-consider Issue for next servicing release review label Nov 3, 2025
Copilot AI and others added 5 commits November 3, 2025 22:53
- Modified PythonAppResourceBuilderExtensions to generate Dockerfiles for all Python apps
- Split Dockerfile generation into two methods: GenerateUvDockerfile and GenerateFallbackDockerfile
- Fallback Dockerfiles detect requirements.txt and run pip install if present
- Uses same runtime image (python:X.Y-slim-bookworm) as UV workflow for consistency
- Updated PythonVersionDetector to accept nullable VirtualEnvironment parameter
- Added comprehensive tests for fallback Dockerfile generation

Co-authored-by: davidfowl <[email protected]>
@github-actions github-actions bot force-pushed the backport/pr-12627-to-release/13.0 branch from a616bfb to 809b552 Compare November 3, 2025 22:53

var pythonVersion = pythonEnvironmentAnnotation.Version ?? PythonVersionDetector.DetectVersion(appDirectory, pythonEnvironmentAnnotation.VirtualEnvironment!);
// Try to get Python environment annotation
context.Resource.TryGetLastAnnotation<PythonEnvironmentAnnotation>(out var pythonEnvironmentAnnotation);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels weird to the discard the value of the TryGet here. It seems like we could still set the fallback Python version even if we did include the if-statement.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logic that is here is what we want. Including an if on the TryGet would make the logic harder to read/follow IMO. The TryGet will output a null annotation if one isn't found, so doing the null checks seems like the easiest way.

@davidfowl davidfowl closed this Nov 4, 2025
@davidfowl davidfowl reopened this Nov 4, 2025
@davidfowl davidfowl merged commit ec32342 into release/13.0 Nov 4, 2025
296 checks passed
@davidfowl davidfowl deleted the backport/pr-12627-to-release/13.0 branch November 4, 2025 04:04
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Re-opened Github-Action PR Servicing-consider Issue for next servicing release review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants