Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a Python virtual environment #190

Conversation

mcdonnnj
Copy link
Member

🗣 Description

This pull request updates the Docker image configuration to use a Python virtual environment.

Note

I am creating this pull request against a branch that will represent a larger body of work. This branch will later have a pull request against develop once the body of work is completed.

💭 Motivation and context

Using virtual environments is a Python best practice. It will also ensure our Python dependencies are isolated from the system Python environment.

🧪 Testing

Automated tests 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.

Instead of relying on `pip3` being on the PATH we instead call the
module through the Python executable. This ensures that the `pip` being
used is in the same environment as the `python3` being used.
Using a virtual environment is a Python best practice. We also
consolidate all of the Python dependency installation steps into a
single RUN instruction. This ensures that Python setup is cached in one
layer and mirrors the logical organization of this being a single step.
@mcdonnnj mcdonnnj added improvement This issue or pull request will add or improve functionality, maintainability, or ease of use docker Pull requests that update Docker code labels Feb 26, 2024
@mcdonnnj mcdonnnj self-assigned this Feb 26, 2024
Copy link
Member

@jsf9k jsf9k left a comment

Choose a reason for hiding this comment

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

One minor ask, otherwise this looks great!

Dockerfile Outdated Show resolved Hide resolved
Since we cannot use long options on Alpine Linux we should explain what
the short options we are using do. I also changed the order of options
so that they are in alphabetical order.

Co-authored-by: Shane Frasier <[email protected]>
Copy link
Member

@dav3r dav3r left a comment

Choose a reason for hiding this comment

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

Very nice! 👍

@mcdonnnj mcdonnnj merged commit 35e8753 into improvement/update_Dockerfile_configuration Feb 27, 2024
16 checks passed
@mcdonnnj mcdonnnj deleted the improvement/use_Python_venv branch February 27, 2024 19:16
@mcdonnnj mcdonnnj mentioned this pull request Mar 6, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Pull requests that update Docker code improvement This issue or pull request will add or improve functionality, maintainability, or ease of use
Projects
Development

Successfully merging this pull request may close these issues.

3 participants