Fix issues 8253, 12325, 11942, 11566, 12580, 14117 - #14540
Conversation
|
Here is the summary of changes. You are about to delete 3 region tags.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Code Review
This pull request updates various samples to use the gemini-2.5-flash model, cleans up region tags in Cloud SQL SQLAlchemy samples, refactors Composer DAG version parsing to handle optional components, and adds a Dockerfile for the Eventarc storage handler. Feedback on these changes includes a recommendation to define WORKDIR earlier in the new Dockerfile to prevent copying dependency manifests to the root directory, and a reminder to pin the newly added google-cloud-logging dependency to a specific version in accordance with the repository's style guidelines.
| # Copy application dependency manifests to the container image. | ||
| # Copying this separately prevents re-running pip install on every code change. | ||
| COPY requirements.txt ./ | ||
|
|
||
| # Install production dependencies. | ||
| RUN pip install -r requirements.txt | ||
|
|
||
| # Copy local code to the container image. | ||
| ENV APP_HOME /app | ||
| WORKDIR $APP_HOME | ||
| COPY . ./ |
There was a problem hiding this comment.
Setting the working directory (WORKDIR) after copying and installing dependencies causes requirements.txt to be copied to the root directory (/) of the container. It is a best practice to define WORKDIR first so that all subsequent copy and run commands are executed within the designated application directory (e.g., /app), keeping the container filesystem clean and organized.
ENV APP_HOME /app
WORKDIR $APP_HOME
# Copy application dependency manifests to the container image.
# Copying this separately prevents re-running pip install on every code change.
COPY requirements.txt ./
# Install production dependencies.
RUN pip install -r requirements.txt
COPY . ./
| @@ -0,0 +1 @@ | |||
| google-cloud-logging>=3.4.0 | |||
There was a problem hiding this comment.
According to the repository's AUTHORING_GUIDE.md, all dependencies in requirements.txt should be pinned to a specific version using == to ensure reproducible environments and prevent unexpected breakages from upstream updates.
google-cloud-logging==3.4.0
References
- All dependencies should be pinned to a specific version, as in this example: Flask==1.1.1 (link)
Description
This PR addresses the following issues in python-docs-samples:
Changes
Testing
git diff --check.Related Issues
Fixes #8253
Fixes #12325
Fixes #11942
Fixes #11566
Fixes #12580
Fixes #14117