Skip to content

Move package versions out of the Dockerfile#287

Open
mcdonnnj wants to merge 4 commits into
developfrom
improvement/break_out_setup_versions
Open

Move package versions out of the Dockerfile#287
mcdonnnj wants to merge 4 commits into
developfrom
improvement/break_out_setup_versions

Conversation

@mcdonnnj

@mcdonnnj mcdonnnj commented Mar 25, 2026

Copy link
Copy Markdown
Member

🗣 Description

This pull request moves versioning of the Python packages we install in the Dockerfile to set up a Python venv out of the Dockerfile. The package version constraints are moved into a separate pip constraints file that is copied in and used during package installation.

💭 Motivation and context

Currently we have to manually update the versions of pip, pipenv, and setuptools that are installed in the venv setup. This change should allow us to get dependabot automatic updates for these packages now.

Note

The constraints file uses the name it does to trick dependabot into offering updates to the packages it lists. This is necessary because dependabot does not work with pip constraints files at this time.

Note

Since I am not changing the versions of the packages used I do not see a reason to bump the version of the image.

🧪 Testing

I tested this locally and it built without issue. Waiting for the pip-audit hook fix to trickle down before automated tests will pass.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All new and existing tests pass.

@mcdonnnj mcdonnnj requested a review from Copilot March 25, 2026 18:41
@mcdonnnj mcdonnnj self-assigned this Mar 25, 2026
@mcdonnnj mcdonnnj requested a review from dav3r as a code owner March 25, 2026 18:41
@mcdonnnj mcdonnnj added the improvement This issue or pull request will add or improve functionality, maintainability, or ease of use label Mar 25, 2026
@mcdonnnj mcdonnnj requested a review from felddy as a code owner March 25, 2026 18:41
@mcdonnnj mcdonnnj requested a review from jsf9k as a code owner March 25, 2026 18:41
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file docker Pull requests that update Docker code labels Mar 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR externalizes the pinned versions for pip, pipenv, and setuptools from the Dockerfile into a dedicated pip constraints file so automated tooling (Dependabot) can propose updates more easily.

Changes:

  • Added src/requirements-actually-constraints.txt to centrally pin pip, pipenv, and setuptools.
  • Updated the Dockerfile to install those tools using pip --constraint constraints.txt instead of hardcoding versions as ENV values.
  • Updated .github/labeler.yml so PRs touching the new constraints file get the dependencies label.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/requirements-actually-constraints.txt New constraints file holding the pinned tool versions for Docker builds.
Dockerfile Uses the constraints file during pip install steps instead of Dockerfile ENV-pinned versions.
.github/labeler.yml Labels changes to the new constraints file as dependency-related.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile
Comment on lines +12 to +13
# Copy in the pip constraints file that controls the versions installed below
COPY src/requirements-actually-constraints.txt ./constraints.txt

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

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

COPY src/requirements-actually-constraints.txt ./constraints.txt relies on the default working directory (/) for later --constraint constraints.txt references. To make this more robust against future WORKDIR changes, consider copying to (and referencing) an absolute path (e.g., /constraints.txt).

Copilot uses AI. Check for mistakes.

@mcdonnnj mcdonnnj Apr 3, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I went with 82699cd as a solution to this feedback. We're still using relative paths, but the WORKDIR command is performed before any COPY commands in the stage.

Comment thread .github/labeler.yml Outdated
@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in Skeleton Maintenance Mar 26, 2026
mcdonnnj and others added 2 commits April 3, 2026 00:58
Move the version constraints for the pip, pipenv, and setuptools
packages out of the Dockerfile. They are moves into a pip constraints
file that _should_ receive automatic updates from dependabot so we can
more easily keep these package versions up-to-date.
This will match a `requirements*.txt` file in any path in the
repository. Since such files are almost always a dependency control
file this rule makes sense.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mcdonnnj mcdonnnj force-pushed the improvement/break_out_setup_versions branch from 79986ce to d3f2ab7 Compare April 3, 2026 05:18
@mcdonnnj mcdonnnj requested review from dav3r and jsf9k April 3, 2026 05:18
Move the `WORKDIR` instruction to before any `COPY` instructions are
performed in `compile-stage`. This sets an expectation for everything
to take place in the specified directory during this stage of the
build.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mcdonnnj mcdonnnj force-pushed the improvement/break_out_setup_versions branch from d3f2ab7 to 82699cd Compare April 3, 2026 06:12

@dav3r dav3r left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Update the entry for `/` to ignore the `src/` sub-directory because we
should handle dependencies in the `src/` sub-directory separately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file docker Pull requests that update Docker code improvement This issue or pull request will add or improve functionality, maintainability, or ease of use

Projects

Status: Reviewer approved

Development

Successfully merging this pull request may close these issues.

4 participants